    001package net.minecraft.world.gen.feature;
    002
    003import java.util.Random;
    004import net.minecraft.block.Block;
    005import net.minecraft.world.World;
    006
    007public class WorldGenGlowStone2 extends WorldGenerator
    008{
    009    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    010    {
    011        if (!par1World.isAirBlock(par3, par4, par5))
    012        {
    013            return false;
    014        }
    015        else if (par1World.getBlockId(par3, par4 + 1, par5) != Block.netherrack.blockID)
    016        {
    017            return false;
    018        }
    019        else
    020        {
    021            par1World.setBlockAndMetadataWithNotify(par3, par4, par5, Block.glowStone.blockID, 0, 2);
    022
    023            for (int l = 0; l < 1500; ++l)
    024            {
    025                int i1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
    026                int j1 = par4 - par2Random.nextInt(12);
    027                int k1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
    028
    029                if (par1World.getBlockId(i1, j1, k1) == 0)
    030                {
    031                    int l1 = 0;
    032
    033                    for (int i2 = 0; i2 < 6; ++i2)
    034                    {
    035                        int j2 = 0;
    036
    037                        if (i2 == 0)
    038                        {
    039                            j2 = par1World.getBlockId(i1 - 1, j1, k1);
    040                        }
    041
    042                        if (i2 == 1)
    043                        {
    044                            j2 = par1World.getBlockId(i1 + 1, j1, k1);
    045                        }
    046
    047                        if (i2 == 2)
    048                        {
    049                            j2 = par1World.getBlockId(i1, j1 - 1, k1);
    050                        }
    051
    052                        if (i2 == 3)
    053                        {
    054                            j2 = par1World.getBlockId(i1, j1 + 1, k1);
    055                        }
    056
    057                        if (i2 == 4)
    058                        {
    059                            j2 = par1World.getBlockId(i1, j1, k1 - 1);
    060                        }
    061
    062                        if (i2 == 5)
    063                        {
    064                            j2 = par1World.getBlockId(i1, j1, k1 + 1);
    065                        }
    066
    067                        if (j2 == Block.glowStone.blockID)
    068                        {
    069                            ++l1;
    070                        }
    071                    }
    072
    073                    if (l1 == 1)
    074                    {
    075                        par1World.setBlockAndMetadataWithNotify(i1, j1, k1, Block.glowStone.blockID, 0, 2);
    076                    }
    077                }
    078            }
    079
    080            return true;
    081        }
    082    }
    083}