    001    package net.minecraft.src;
    002
    003    import java.util.Random;
    004
    005    public class WorldGenLiquids extends WorldGenerator
    006    {
    007        /** The ID of the liquid block used in this liquid generator. */
    008        private int liquidBlockId;
    009
    010        public WorldGenLiquids(int par1)
    011        {
    012            this.liquidBlockId = par1;
    013        }
    014
    015        public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    016        {
    017            if (par1World.getBlockId(par3, par4 + 1, par5) != Block.stone.blockID)
    018            {
    019                return false;
    020            }
    021            else if (par1World.getBlockId(par3, par4 - 1, par5) != Block.stone.blockID)
    022            {
    023                return false;
    024            }
    025            else if (par1World.getBlockId(par3, par4, par5) != 0 && par1World.getBlockId(par3, par4, par5) != Block.stone.blockID)
    026            {
    027                return false;
    028            }
    029            else
    030            {
    031                int var6 = 0;
    032
    033                if (par1World.getBlockId(par3 - 1, par4, par5) == Block.stone.blockID)
    034                {
    035                    ++var6;
    036                }
    037
    038                if (par1World.getBlockId(par3 + 1, par4, par5) == Block.stone.blockID)
    039                {
    040                    ++var6;
    041                }
    042
    043                if (par1World.getBlockId(par3, par4, par5 - 1) == Block.stone.blockID)
    044                {
    045                    ++var6;
    046                }
    047
    048                if (par1World.getBlockId(par3, par4, par5 + 1) == Block.stone.blockID)
    049                {
    050                    ++var6;
    051                }
    052
    053                int var7 = 0;
    054
    055                if (par1World.isAirBlock(par3 - 1, par4, par5))
    056                {
    057                    ++var7;
    058                }
    059
    060                if (par1World.isAirBlock(par3 + 1, par4, par5))
    061                {
    062                    ++var7;
    063                }
    064
    065                if (par1World.isAirBlock(par3, par4, par5 - 1))
    066                {
    067                    ++var7;
    068                }
    069
    070                if (par1World.isAirBlock(par3, par4, par5 + 1))
    071                {
    072                    ++var7;
    073                }
    074
    075                if (var6 == 3 && var7 == 1)
    076                {
    077                    par1World.setBlockWithNotify(par3, par4, par5, this.liquidBlockId);
    078                    par1World.scheduledUpdatesAreImmediate = true;
    079                    Block.blocksList[this.liquidBlockId].updateTick(par1World, par3, par4, par5, par2Random);
    080                    par1World.scheduledUpdatesAreImmediate = false;
    081                }
    082
    083                return true;
    084            }
    085        }
    086    }