    001    package net.minecraft.src;
    002
    003    import java.util.Random;
    004
    005    public class WorldGenTallGrass extends WorldGenerator
    006    {
    007        /** Stores ID for WorldGenTallGrass */
    008        private int tallGrassID;
    009        private int tallGrassMetadata;
    010
    011        public WorldGenTallGrass(int par1, int par2)
    012        {
    013            this.tallGrassID = par1;
    014            this.tallGrassMetadata = par2;
    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 < 128; ++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.tallGrassID].canBlockStay(par1World, var8, var9, var10))
    039                {
    040                    par1World.setBlockAndMetadata(var8, var9, var10, this.tallGrassID, this.tallGrassMetadata);
    041                }
    042            }
    043
    044            return true;
    045        }
    046    }