WorldGenMegaJungle .java

net.minecraft.world.gen.feature.WorldGenMegaJungle (class, 134 lines): members: generate. imports: BlockVine, PropertyBool, MathHelper, IBlockState.

net.minecraft.world.gen.featureclass134 linescommonextends WorldGenHugeTrees5.0 KB

API Surface (1)

boolean generate(World worldIn, Random rand, BlockPos position)

Full Source

WorldGenMegaJungle.java134 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import java.util.Random;
4
import net.minecraft.block.BlockVine;
5
import net.minecraft.block.properties.PropertyBool;
6
import net.minecraft.block.state.IBlockState;
7
import net.minecraft.init.Blocks;
8
import net.minecraft.util.BlockPos;
9
import net.minecraft.util.MathHelper;
10
import net.minecraft.world.World;
11
12
public class WorldGenMegaJungle extends WorldGenHugeTrees
13
{
14
    public WorldGenMegaJungle(boolean p_i46448_1_, int p_i46448_2_, int p_i46448_3_, IBlockState p_i46448_4_, IBlockState p_i46448_5_)
15
    {
16
        super(p_i46448_1_, p_i46448_2_, p_i46448_3_, p_i46448_4_, p_i46448_5_);
17
    }
18
19
    public boolean generate(World worldIn, Random rand, BlockPos position)
20
    {
21
        int i = this.func_150533_a(rand);
22
23
        if (!this.func_175929_a(worldIn, rand, position, i))
24
        {
25
            return false;
26
        }
27
        else
28
        {
29
            this.func_175930_c(worldIn, position.up(i), 2);
30
31
            for (int j = position.getY() + i - 2 - rand.nextInt(4); j > position.getY() + i / 2; j -= 2 + rand.nextInt(4))
32
            {
33
                float f = rand.nextFloat() * (float)Math.PI * 2.0F;
34
                int k = position.getX() + (int)(0.5F + MathHelper.cos(f) * 4.0F);
35
                int l = position.getZ() + (int)(0.5F + MathHelper.sin(f) * 4.0F);
36
37
                for (int i1 = 0; i1 < 5; ++i1)
38
                {
39
                    k = position.getX() + (int)(1.5F + MathHelper.cos(f) * (float)i1);
40
                    l = position.getZ() + (int)(1.5F + MathHelper.sin(f) * (float)i1);
41
                    this.setBlockAndNotifyAdequately(worldIn, new BlockPos(k, j - 3 + i1 / 2, l), this.woodMetadata);
42
                }
43
44
                int j2 = 1 + rand.nextInt(2);
45
                int j1 = j;
46
47
                for (int k1 = j - j2; k1 <= j1; ++k1)
48
                {
49
                    int l1 = k1 - j1;
50
                    this.func_175928_b(worldIn, new BlockPos(k, k1, l), 1 - l1);
51
                }
52
            }
53
54
            for (int i2 = 0; i2 < i; ++i2)
55
            {
56
                BlockPos blockpos = position.up(i2);
57
58
                if (this.func_150523_a(worldIn.getBlockState(blockpos).getBlock()))
59
                {
60
                    this.setBlockAndNotifyAdequately(worldIn, blockpos, this.woodMetadata);
61
62
                    if (i2 > 0)
63
                    {
64
                        this.func_181632_a(worldIn, rand, blockpos.west(), BlockVine.EAST);
65
                        this.func_181632_a(worldIn, rand, blockpos.north(), BlockVine.SOUTH);
66
                    }
67
                }
68
69
                if (i2 < i - 1)
70
                {
71
                    BlockPos blockpos1 = blockpos.east();
72
73
                    if (this.func_150523_a(worldIn.getBlockState(blockpos1).getBlock()))
74
                    {
75
                        this.setBlockAndNotifyAdequately(worldIn, blockpos1, this.woodMetadata);
76
77
                        if (i2 > 0)
78
                        {
79
                            this.func_181632_a(worldIn, rand, blockpos1.east(), BlockVine.WEST);
80
                            this.func_181632_a(worldIn, rand, blockpos1.north(), BlockVine.SOUTH);
81
                        }
82
                    }
83
84
                    BlockPos blockpos2 = blockpos.south().east();
85
86
                    if (this.func_150523_a(worldIn.getBlockState(blockpos2).getBlock()))
87
                    {
88
                        this.setBlockAndNotifyAdequately(worldIn, blockpos2, this.woodMetadata);
89
90
                        if (i2 > 0)
91
                        {
92
                            this.func_181632_a(worldIn, rand, blockpos2.east(), BlockVine.WEST);
93
                            this.func_181632_a(worldIn, rand, blockpos2.south(), BlockVine.NORTH);
94
                        }
95
                    }
96
97
                    BlockPos blockpos3 = blockpos.south();
98
99
                    if (this.func_150523_a(worldIn.getBlockState(blockpos3).getBlock()))
100
                    {
101
                        this.setBlockAndNotifyAdequately(worldIn, blockpos3, this.woodMetadata);
102
103
                        if (i2 > 0)
104
                        {
105
                            this.func_181632_a(worldIn, rand, blockpos3.west(), BlockVine.EAST);
106
                            this.func_181632_a(worldIn, rand, blockpos3.south(), BlockVine.NORTH);
107
                        }
108
                    }
109
                }
110
            }
111
112
            return true;
113
        }
114
    }
115
116
    private void func_181632_a(World p_181632_1_, Random p_181632_2_, BlockPos p_181632_3_, PropertyBool p_181632_4_)
117
    {
118
        if (p_181632_2_.nextInt(3) > 0 && p_181632_1_.isAirBlock(p_181632_3_))
119
        {
120
            this.setBlockAndNotifyAdequately(p_181632_1_, p_181632_3_, Blocks.vine.getDefaultState().withProperty(p_181632_4_, Boolean.valueOf(true)));
121
        }
122
    }
123
124
    private void func_175930_c(World worldIn, BlockPos p_175930_2_, int p_175930_3_)
125
    {
126
        int i = 2;
127
128
        for (int j = -i; j <= 0; ++j)
129
        {
130
            this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j);
131
        }
132
    }
133
}
134

Deobfuscated MCP 1.8.9 source of WorldGenMegaJungle from Marcelektro/MavenMCP-1.8.9 (net/minecraft/world/gen/feature/WorldGenMegaJungle.java), stored verbatim.