    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 WorldGenTallGrass extends WorldGenerator
    008    {
    009        /** Stores ID for WorldGenTallGrass */
    010        private int tallGrassID;
    011        private int tallGrassMetadata;
    012
    013        public WorldGenTallGrass(int par1, int par2)
    014        {
    015            this.tallGrassID = par1;
    016            this.tallGrassMetadata = par2;
    017        }
    018
    019        public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    020        {
    021            int var11;
    022
    023            Block block = null;
    024            do
    025            {
    026                block = Block.blocksList[par1World.getBlockId(par3,  par4, par5)];
    027                if (block != null && !block.isLeaves(par1World, par3, par4, par5))
    028                {
    029                    break;
    030                }
    031                par4--;
    032            } while (par4 > 0);
    033
    034            for (int var7 = 0; var7 < 128; ++var7)
    035            {
    036                int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
    037                int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
    038                int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
    039
    040                if (par1World.isAirBlock(var8, var9, var10) && Block.blocksList[this.tallGrassID].canBlockStay(par1World, var8, var9, var10))
    041                {
    042                    par1World.setBlockAndMetadata(var8, var9, var10, this.tallGrassID, this.tallGrassMetadata);
    043                }
    044            }
    045
    046            return true;
    047        }
    048    }