    001package net.minecraft.world.gen.feature;
    002
    003import java.util.Random;
    004import net.minecraft.block.Block;
    005import net.minecraft.world.World;
    006
    007public 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 l;
    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 i1 = 0; i1 < 128; ++i1)
    035        {
    036            int j1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
    037            int k1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
    038            int l1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
    039
    040            if (par1World.isAirBlock(j1, k1, l1) && Block.blocksList[this.tallGrassID].canBlockStay(par1World, j1, k1, l1))
    041            {
    042                par1World.setBlockAndMetadataWithNotify(j1, k1, l1, this.tallGrassID, this.tallGrassMetadata, 2);
    043            }
    044        }
    045
    046        return true;
    047    }
    048}