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