    001    package net.minecraft.world.gen.feature;
    002
    003    import java.util.Random;
    004    import net.minecraft.block.Block;
    005    import net.minecraft.world.World;
    006
    007    public 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 var11;
    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 var7 = 0; var7 < 4; ++var7)
    033            {
    034                int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
    035                int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
    036                int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
    037
    038                if (par1World.isAirBlock(var8, var9, var10) && Block.blocksList[this.deadBushID].canBlockStay(par1World, var8, var9, var10))
    039                {
    040                    par1World.setBlock(var8, var9, var10, this.deadBushID);
    041                }
    042            }
    043
    044            return true;
    045        }
    046    }