WorldGenIcePath .java

net.minecraft.world.gen.feature.WorldGenIcePath (class, 62 lines): extends WorldGenerator. members: basePathWidth, block, generate. imports: Block.

net.minecraft.world.gen.featureclass62 linescommonextends WorldGenerator1.9 KB

API Surface (1)

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

Fields & Constants (2)

block
basePathWidth

Code Graph: Dependencies (5)

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

Full Source

WorldGenIcePath.java62 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 WorldGenIcePath extends WorldGenerator
10
{
11
    private Block block = Blocks.packed_ice;
12
    private int basePathWidth;
13
14
    public WorldGenIcePath(int p_i45454_1_)
15
    {
16
        this.basePathWidth = p_i45454_1_;
17
    }
18
19
    public boolean generate(World worldIn, Random rand, BlockPos position)
20
    {
21
        while (worldIn.isAirBlock(position) && position.getY() > 2)
22
        {
23
            position = position.down();
24
        }
25
26
        if (worldIn.getBlockState(position).getBlock() != Blocks.snow)
27
        {
28
            return false;
29
        }
30
        else
31
        {
32
            int i = rand.nextInt(this.basePathWidth - 2) + 2;
33
            int j = 1;
34
35
            for (int k = position.getX() - i; k <= position.getX() + i; ++k)
36
            {
37
                for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
38
                {
39
                    int i1 = k - position.getX();
40
                    int j1 = l - position.getZ();
41
42
                    if (i1 * i1 + j1 * j1 <= i * i)
43
                    {
44
                        for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
45
                        {
46
                            BlockPos blockpos = new BlockPos(k, k1, l);
47
                            Block block = worldIn.getBlockState(blockpos).getBlock();
48
49
                            if (block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice)
50
                            {
51
                                worldIn.setBlockState(blockpos, this.block.getDefaultState(), 2);
52
                            }
53
                        }
54
                    }
55
                }
56
            }
57
58
            return true;
59
        }
60
    }
61
}
62

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