    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 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 var6 = 0; var6 < 64; ++var6)
    020            {
    021                int var7 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
    022                int var8 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
    023                int var9 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
    024
    025                if (par1World.isAirBlock(var7, var8, var9) && (!par1World.provider.hasNoSky || var8 < 127) && Block.blocksList[this.plantBlockId].canBlockStay(par1World, var7, var8, var9))
    026                {
    027                    par1World.setBlock(var7, var8, var9, this.plantBlockId);
    028                }
    029            }
    030
    031            return true;
    032        }
    033    }