WorldGenReed .java

net.minecraft.world.gen.feature.WorldGenReed (class, 39 lines): extends WorldGenerator. members: generate. imports: Material.

net.minecraft.world.gen.featureclass39 linescommonextends WorldGenerator1.4 KB

API Surface (1)

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

Code Graph: Dependencies (5)

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

Full Source

WorldGenReed.java39 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen.feature;
2
3
import java.util.Random;
4
import net.minecraft.block.material.Material;
5
import net.minecraft.init.Blocks;
6
import net.minecraft.util.BlockPos;
7
import net.minecraft.world.World;
8
9
public class WorldGenReed extends WorldGenerator
10
{
11
    public boolean generate(World worldIn, Random rand, BlockPos position)
12
    {
13
        for (int i = 0; i < 20; ++i)
14
        {
15
            BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4));
16
17
            if (worldIn.isAirBlock(blockpos))
18
            {
19
                BlockPos blockpos1 = blockpos.down();
20
21
                if (worldIn.getBlockState(blockpos1.west()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.east()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.north()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.south()).getBlock().getMaterial() == Material.water)
22
                {
23
                    int j = 2 + rand.nextInt(rand.nextInt(3) + 1);
24
25
                    for (int k = 0; k < j; ++k)
26
                    {
27
                        if (Blocks.reeds.canBlockStay(worldIn, blockpos))
28
                        {
29
                            worldIn.setBlockState(blockpos.up(k), Blocks.reeds.getDefaultState(), 2);
30
                        }
31
                    }
32
                }
33
            }
34
        }
35
36
        return true;
37
    }
38
}
39

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