    001package net.minecraft.world.gen.feature;
    002
    003import java.util.Random;
    004import net.minecraft.block.Block;
    005import net.minecraft.world.World;
    006
    007public class WorldGenDeadBush extends WorldGenerator
    008{
    009    /** stores the ID for WorldGenDeadBush */
    010    private int deadBushID;
    011
    012    public WorldGenDeadBush(int par1)
    013    {
    014        this.deadBushID = par1;
    015    }
    016
    017    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    018    {
    019        int l;
    020
    021        Block block = null;
    022        do
    023        {
    024            block = Block.blocksList[par1World.getBlockId(par3,  par4, par5)];
    025            if (block != null && !block.isLeaves(par1World, par3, par4, par5))
    026            {
    027                break;
    028            }
    029            par4--;
    030        } while (par4 > 0);
    031
    032        for (int i1 = 0; i1 < 4; ++i1)
    033        {
    034            int j1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
    035            int k1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
    036            int l1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
    037
    038            if (par1World.isAirBlock(j1, k1, l1) && Block.blocksList[this.deadBushID].canBlockStay(par1World, j1, k1, l1))
    039            {
    040                par1World.setBlock(j1, k1, l1, this.deadBushID, 0, 2);
    041            }
    042        }
    043
    044        return true;
    045    }
    046}