WorldGenDesertWells .java

net.minecraft.world.gen.feature.WorldGenDesertWells (class, 107 lines): members: field_175910_d, field_175911_b, field_175912_c, field_175913_a, generate.

net.minecraft.world.gen.featureclass107 linescommonextends WorldGenerator4.0 KB

API Surface (1)

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

Fields & Constants (4)

field_175913_a
field_175911_b
field_175912_c
field_175910_d

Full Source

WorldGenDesertWells.java107 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import com.google.common.base.Predicates;
4
import java.util.Random;
5
import net.minecraft.block.BlockSand;
6
import net.minecraft.block.BlockSlab;
7
import net.minecraft.block.BlockStoneSlab;
8
import net.minecraft.block.state.IBlockState;
9
import net.minecraft.block.state.pattern.BlockStateHelper;
10
import net.minecraft.init.Blocks;
11
import net.minecraft.util.BlockPos;
12
import net.minecraft.util.EnumFacing;
13
import net.minecraft.world.World;
14
15
public class WorldGenDesertWells extends WorldGenerator
16
{
17
    private static final BlockStateHelper field_175913_a = BlockStateHelper.forBlock(Blocks.sand).where(BlockSand.VARIANT, Predicates.equalTo(BlockSand.EnumType.SAND));
18
    private final IBlockState field_175911_b = Blocks.stone_slab.getDefaultState().withProperty(BlockStoneSlab.VARIANT, BlockStoneSlab.EnumType.SAND).withProperty(BlockSlab.HALF, BlockSlab.EnumBlockHalf.BOTTOM);
19
    private final IBlockState field_175912_c = Blocks.sandstone.getDefaultState();
20
    private final IBlockState field_175910_d = Blocks.flowing_water.getDefaultState();
21
22
    public boolean generate(World worldIn, Random rand, BlockPos position)
23
    {
24
        while (worldIn.isAirBlock(position) && position.getY() > 2)
25
        {
26
            position = position.down();
27
        }
28
29
        if (!field_175913_a.apply(worldIn.getBlockState(position)))
30
        {
31
            return false;
32
        }
33
        else
34
        {
35
            for (int i = -2; i <= 2; ++i)
36
            {
37
                for (int j = -2; j <= 2; ++j)
38
                {
39
                    if (worldIn.isAirBlock(position.add(i, -1, j)) && worldIn.isAirBlock(position.add(i, -2, j)))
40
                    {
41
                        return false;
42
                    }
43
                }
44
            }
45
46
            for (int l = -1; l <= 0; ++l)
47
            {
48
                for (int l1 = -2; l1 <= 2; ++l1)
49
                {
50
                    for (int k = -2; k <= 2; ++k)
51
                    {
52
                        worldIn.setBlockState(position.add(l1, l, k), this.field_175912_c, 2);
53
                    }
54
                }
55
            }
56
57
            worldIn.setBlockState(position, this.field_175910_d, 2);
58
59
            for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
60
            {
61
                worldIn.setBlockState(position.offset(enumfacing), this.field_175910_d, 2);
62
            }
63
64
            for (int i1 = -2; i1 <= 2; ++i1)
65
            {
66
                for (int i2 = -2; i2 <= 2; ++i2)
67
                {
68
                    if (i1 == -2 || i1 == 2 || i2 == -2 || i2 == 2)
69
                    {
70
                        worldIn.setBlockState(position.add(i1, 1, i2), this.field_175912_c, 2);
71
                    }
72
                }
73
            }
74
75
            worldIn.setBlockState(position.add(2, 1, 0), this.field_175911_b, 2);
76
            worldIn.setBlockState(position.add(-2, 1, 0), this.field_175911_b, 2);
77
            worldIn.setBlockState(position.add(0, 1, 2), this.field_175911_b, 2);
78
            worldIn.setBlockState(position.add(0, 1, -2), this.field_175911_b, 2);
79
80
            for (int j1 = -1; j1 <= 1; ++j1)
81
            {
82
                for (int j2 = -1; j2 <= 1; ++j2)
83
                {
84
                    if (j1 == 0 && j2 == 0)
85
                    {
86
                        worldIn.setBlockState(position.add(j1, 4, j2), this.field_175912_c, 2);
87
                    }
88
                    else
89
                    {
90
                        worldIn.setBlockState(position.add(j1, 4, j2), this.field_175911_b, 2);
91
                    }
92
                }
93
            }
94
95
            for (int k1 = 1; k1 <= 3; ++k1)
96
            {
97
                worldIn.setBlockState(position.add(-1, k1, -1), this.field_175912_c, 2);
98
                worldIn.setBlockState(position.add(-1, k1, 1), this.field_175912_c, 2);
99
                worldIn.setBlockState(position.add(1, k1, -1), this.field_175912_c, 2);
100
                worldIn.setBlockState(position.add(1, k1, 1), this.field_175912_c, 2);
101
            }
102
103
            return true;
104
        }
105
    }
106
}
107

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