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