WorldGenClay .java

net.minecraft.world.gen.feature.WorldGenClay (class, 60 lines): extends WorldGenerator. members: field_150546_a, numberOfBlocks, generate. imports: Block.

net.minecraft.world.gen.featureclass60 linescommonextends WorldGenerator1.8 KB

API Surface (1)

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

Fields & Constants (2)

field_150546_a
numberOfBlocks

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

WorldGenClay.java60 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.material.Material;
6
import net.minecraft.init.Blocks;
7
import net.minecraft.util.BlockPos;
8
import net.minecraft.world.World;
9
10
public class WorldGenClay extends WorldGenerator
11
{
12
    private Block field_150546_a = Blocks.clay;
13
14
    /** The number of blocks to generate. */
15
    private int numberOfBlocks;
16
17
    public WorldGenClay(int p_i2011_1_)
18
    {
19
        this.numberOfBlocks = p_i2011_1_;
20
    }
21
22
    public boolean generate(World worldIn, Random rand, BlockPos position)
23
    {
24
        if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.water)
25
        {
26
            return false;
27
        }
28
        else
29
        {
30
            int i = rand.nextInt(this.numberOfBlocks - 2) + 2;
31
            int j = 1;
32
33
            for (int k = position.getX() - i; k <= position.getX() + i; ++k)
34
            {
35
                for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
36
                {
37
                    int i1 = k - position.getX();
38
                    int j1 = l - position.getZ();
39
40
                    if (i1 * i1 + j1 * j1 <= i * i)
41
                    {
42
                        for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
43
                        {
44
                            BlockPos blockpos = new BlockPos(k, k1, l);
45
                            Block block = worldIn.getBlockState(blockpos).getBlock();
46
47
                            if (block == Blocks.dirt || block == Blocks.clay)
48
                            {
49
                                worldIn.setBlockState(blockpos, this.field_150546_a.getDefaultState(), 2);
50
                            }
51
                        }
52
                    }
53
                }
54
            }
55
56
            return true;
57
        }
58
    }
59
}
60

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