    001package net.minecraft.world.gen.feature;
    002
    003import java.util.Random;
    004import net.minecraft.block.Block;
    005import net.minecraft.world.World;
    006
    007public class WorldGenFlowers extends WorldGenerator
    008{
    009    /** The ID of the plant block used in this plant generator. */
    010    private int plantBlockId;
    011
    012    public WorldGenFlowers(int par1)
    013    {
    014        this.plantBlockId = par1;
    015    }
    016
    017    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    018    {
    019        for (int l = 0; l < 64; ++l)
    020        {
    021            int i1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
    022            int j1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
    023            int k1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
    024
    025            if (par1World.isAirBlock(i1, j1, k1) && (!par1World.provider.hasNoSky || j1 < 127) && Block.blocksList[this.plantBlockId].canBlockStay(par1World, i1, j1, k1))
    026            {
    027                par1World.setBlockAndMetadataWithNotify(i1, j1, k1, this.plantBlockId, 0, 2);
    028            }
    029        }
    030
    031        return true;
    032    }
    033}