WorldGenDeadBush .java

net.minecraft.world.gen.feature.WorldGenDeadBush (class, 34 lines): extends WorldGenerator. members: generate. imports: Block.

net.minecraft.world.gen.featureclass34 linescommonextends WorldGenerator1.1 KB

API Surface (1)

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

Code Graph: Dependencies (6)

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

Full Source

WorldGenDeadBush.java34 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 WorldGenDeadBush extends WorldGenerator
11
{
12
    public boolean generate(World worldIn, Random rand, BlockPos position)
13
    {
14
        Block block;
15
16
        while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
17
        {
18
            position = position.down();
19
        }
20
21
        for (int i = 0; i < 4; ++i)
22
        {
23
            BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
24
25
            if (worldIn.isAirBlock(blockpos) && Blocks.deadbush.canBlockStay(worldIn, blockpos, Blocks.deadbush.getDefaultState()))
26
            {
27
                worldIn.setBlockState(blockpos, Blocks.deadbush.getDefaultState(), 2);
28
            }
29
        }
30
31
        return true;
32
    }
33
}
34

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