WorldGenBlockBlob .java

net.minecraft.world.gen.feature.WorldGenBlockBlob (class, 73 lines): members: field_150544_b, field_150545_a, generate. imports: Block.

net.minecraft.world.gen.featureclass73 linescommonextends WorldGenerator2.2 KB

API Surface (1)

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

Fields & Constants (2)

field_150545_a
field_150544_b

Code Graph: Dependencies (5)

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

Full Source

WorldGenBlockBlob.java73 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.init.Blocks;
6
import net.minecraft.util.BlockPos;
7
import net.minecraft.world.World;
8
9
public class WorldGenBlockBlob extends WorldGenerator
10
{
11
    private final Block field_150545_a;
12
    private final int field_150544_b;
13
14
    public WorldGenBlockBlob(Block p_i45450_1_, int p_i45450_2_)
15
    {
16
        super(false);
17
        this.field_150545_a = p_i45450_1_;
18
        this.field_150544_b = p_i45450_2_;
19
    }
20
21
    public boolean generate(World worldIn, Random rand, BlockPos position)
22
    {
23
        while (true)
24
        {
25
            label0:
26
            {
27
                if (position.getY() > 3)
28
                {
29
                    if (worldIn.isAirBlock(position.down()))
30
                    {
31
                        break label0;
32
                    }
33
34
                    Block block = worldIn.getBlockState(position.down()).getBlock();
35
36
                    if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.stone)
37
                    {
38
                        break label0;
39
                    }
40
                }
41
42
                if (position.getY() <= 3)
43
                {
44
                    return false;
45
                }
46
47
                int i1 = this.field_150544_b;
48
49
                for (int i = 0; i1 >= 0 && i < 3; ++i)
50
                {
51
                    int j = i1 + rand.nextInt(2);
52
                    int k = i1 + rand.nextInt(2);
53
                    int l = i1 + rand.nextInt(2);
54
                    float f = (float)(j + k + l) * 0.333F + 0.5F;
55
56
                    for (BlockPos blockpos : BlockPos.getAllInBox(position.add(-j, -k, -l), position.add(j, k, l)))
57
                    {
58
                        if (blockpos.distanceSq(position) <= (double)(f * f))
59
                        {
60
                            worldIn.setBlockState(blockpos, this.field_150545_a.getDefaultState(), 4);
61
                        }
62
                    }
63
64
                    position = position.add(-(i1 + 1) + rand.nextInt(2 + i1 * 2), 0 - rand.nextInt(2), -(i1 + 1) + rand.nextInt(2 + i1 * 2));
65
                }
66
67
                return true;
68
            }
69
            position = position.down();
70
        }
71
    }
72
}
73

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