    001    package net.minecraft.src;
    002
    003    import java.util.Random;
    004
    005    public class WorldGenHellLava extends WorldGenerator
    006    {
    007        /** Stores the ID for WorldGenHellLava */
    008        private int hellLavaID;
    009
    010        public WorldGenHellLava(int par1)
    011        {
    012            this.hellLavaID = 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.netherrack.blockID)
    018            {
    019                return false;
    020            }
    021            else if (par1World.getBlockId(par3, par4, par5) != 0 && par1World.getBlockId(par3, par4, par5) != Block.netherrack.blockID)
    022            {
    023                return false;
    024            }
    025            else
    026            {
    027                int var6 = 0;
    028
    029                if (par1World.getBlockId(par3 - 1, par4, par5) == Block.netherrack.blockID)
    030                {
    031                    ++var6;
    032                }
    033
    034                if (par1World.getBlockId(par3 + 1, par4, par5) == Block.netherrack.blockID)
    035                {
    036                    ++var6;
    037                }
    038
    039                if (par1World.getBlockId(par3, par4, par5 - 1) == Block.netherrack.blockID)
    040                {
    041                    ++var6;
    042                }
    043
    044                if (par1World.getBlockId(par3, par4, par5 + 1) == Block.netherrack.blockID)
    045                {
    046                    ++var6;
    047                }
    048
    049                if (par1World.getBlockId(par3, par4 - 1, par5) == Block.netherrack.blockID)
    050                {
    051                    ++var6;
    052                }
    053
    054                int var7 = 0;
    055
    056                if (par1World.isAirBlock(par3 - 1, par4, par5))
    057                {
    058                    ++var7;
    059                }
    060
    061                if (par1World.isAirBlock(par3 + 1, par4, par5))
    062                {
    063                    ++var7;
    064                }
    065
    066                if (par1World.isAirBlock(par3, par4, par5 - 1))
    067                {
    068                    ++var7;
    069                }
    070
    071                if (par1World.isAirBlock(par3, par4, par5 + 1))
    072                {
    073                    ++var7;
    074                }
    075
    076                if (par1World.isAirBlock(par3, par4 - 1, par5))
    077                {
    078                    ++var7;
    079                }
    080
    081                if (var6 == 4 && var7 == 1)
    082                {
    083                    par1World.setBlockWithNotify(par3, par4, par5, this.hellLavaID);
    084                    par1World.scheduledUpdatesAreImmediate = true;
    085                    Block.blocksList[this.hellLavaID].updateTick(par1World, par3, par4, par5, par2Random);
    086                    par1World.scheduledUpdatesAreImmediate = false;
    087                }
    088
    089                return true;
    090            }
    091        }
    092    }