    001    package net.minecraft.src;
    002
    003    import java.util.Random;
    004
    005    public class WorldGenClay extends WorldGenerator
    006    {
    007        /** The block ID for clay. */
    008        private int clayBlockId;
    009
    010        /** The number of blocks to generate. */
    011        private int numberOfBlocks;
    012
    013        public WorldGenClay(int par1)
    014        {
    015            this.clayBlockId = Block.blockClay.blockID;
    016            this.numberOfBlocks = par1;
    017        }
    018
    019        public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    020        {
    021            if (par1World.getBlockMaterial(par3, par4, par5) != Material.water)
    022            {
    023                return false;
    024            }
    025            else
    026            {
    027                int var6 = par2Random.nextInt(this.numberOfBlocks - 2) + 2;
    028                byte var7 = 1;
    029
    030                for (int var8 = par3 - var6; var8 <= par3 + var6; ++var8)
    031                {
    032                    for (int var9 = par5 - var6; var9 <= par5 + var6; ++var9)
    033                    {
    034                        int var10 = var8 - par3;
    035                        int var11 = var9 - par5;
    036
    037                        if (var10 * var10 + var11 * var11 <= var6 * var6)
    038                        {
    039                            for (int var12 = par4 - var7; var12 <= par4 + var7; ++var12)
    040                            {
    041                                int var13 = par1World.getBlockId(var8, var12, var9);
    042
    043                                if (var13 == Block.dirt.blockID || var13 == Block.blockClay.blockID)
    044                                {
    045                                    par1World.setBlock(var8, var12, var9, this.clayBlockId);
    046                                }
    047                            }
    048                        }
    049                    }
    050                }
    051
    052                return true;
    053            }
    054        }
    055    }