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