WorldGenTaiga1 .java

net.minecraft.world.gen.feature.WorldGenTaiga1 (class): members: field_181636_a, field_181637_b, generate. imports: BlockOldLeaf, BlockOldLog, BlockLeaves.

net.minecraft.world.gen.featureclass138 linescommonextends WorldGenAbstractTree4.8 KB

API Surface (1)

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

Fields & Constants (2)

field_181636_a
field_181637_b

Full Source

WorldGenTaiga1.java138 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import java.util.Random;
4
import net.minecraft.block.Block;
5
import net.minecraft.block.BlockLeaves;
6
import net.minecraft.block.BlockOldLeaf;
7
import net.minecraft.block.BlockOldLog;
8
import net.minecraft.block.BlockPlanks;
9
import net.minecraft.block.material.Material;
10
import net.minecraft.block.state.IBlockState;
11
import net.minecraft.init.Blocks;
12
import net.minecraft.util.BlockPos;
13
import net.minecraft.world.World;
14
15
public class WorldGenTaiga1 extends WorldGenAbstractTree
16
{
17
    private static final IBlockState field_181636_a = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE);
18
    private static final IBlockState field_181637_b = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
19
20
    public WorldGenTaiga1()
21
    {
22
        super(false);
23
    }
24
25
    public boolean generate(World worldIn, Random rand, BlockPos position)
26
    {
27
        int i = rand.nextInt(5) + 7;
28
        int j = i - rand.nextInt(2) - 3;
29
        int k = i - j;
30
        int l = 1 + rand.nextInt(k + 1);
31
        boolean flag = true;
32
33
        if (position.getY() >= 1 && position.getY() + i + 1 <= 256)
34
        {
35
            for (int i1 = position.getY(); i1 <= position.getY() + 1 + i && flag; ++i1)
36
            {
37
                int j1 = 1;
38
39
                if (i1 - position.getY() < j)
40
                {
41
                    j1 = 0;
42
                }
43
                else
44
                {
45
                    j1 = l;
46
                }
47
48
                BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
49
50
                for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1)
51
                {
52
                    for (int l1 = position.getZ() - j1; l1 <= position.getZ() + j1 && flag; ++l1)
53
                    {
54
                        if (i1 >= 0 && i1 < 256)
55
                        {
56
                            if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock()))
57
                            {
58
                                flag = false;
59
                            }
60
                        }
61
                        else
62
                        {
63
                            flag = false;
64
                        }
65
                    }
66
                }
67
            }
68
69
            if (!flag)
70
            {
71
                return false;
72
            }
73
            else
74
            {
75
                Block block = worldIn.getBlockState(position.down()).getBlock();
76
77
                if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1)
78
                {
79
                    this.func_175921_a(worldIn, position.down());
80
                    int k2 = 0;
81
82
                    for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2)
83
                    {
84
                        for (int j3 = position.getX() - k2; j3 <= position.getX() + k2; ++j3)
85
                        {
86
                            int k3 = j3 - position.getX();
87
88
                            for (int i2 = position.getZ() - k2; i2 <= position.getZ() + k2; ++i2)
89
                            {
90
                                int j2 = i2 - position.getZ();
91
92
                                if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0)
93
                                {
94
                                    BlockPos blockpos = new BlockPos(j3, l2, i2);
95
96
                                    if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock())
97
                                    {
98
                                        this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b);
99
                                    }
100
                                }
101
                            }
102
                        }
103
104
                        if (k2 >= 1 && l2 == position.getY() + j + 1)
105
                        {
106
                            --k2;
107
                        }
108
                        else if (k2 < l)
109
                        {
110
                            ++k2;
111
                        }
112
                    }
113
114
                    for (int i3 = 0; i3 < i - 1; ++i3)
115
                    {
116
                        Block block1 = worldIn.getBlockState(position.up(i3)).getBlock();
117
118
                        if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves)
119
                        {
120
                            this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a);
121
                        }
122
                    }
123
124
                    return true;
125
                }
126
                else
127
                {
128
                    return false;
129
                }
130
            }
131
        }
132
        else
133
        {
134
            return false;
135
        }
136
    }
137
}
138

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