BiomesOPlenty/common/biomesoplenty/worldgen/WorldGenNetherGrass.java

121 lines
3.6 KiB
Java
Raw Normal View History

package biomesoplenty.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.Blocks;
public class WorldGenNetherGrass extends WorldGenerator
{
2013-05-31 10:34:02 +00:00
/** Stores ID for WorldGenTallGrass */
private int tallGrassID;
private int tallGrassMetadata;
2013-05-31 10:34:02 +00:00
public WorldGenNetherGrass(int par1, int par2)
{
tallGrassID = par1;
tallGrassMetadata = par2;
}
2013-05-31 10:34:02 +00:00
@Override
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
int var11;
2013-05-31 10:34:02 +00:00
for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4)
{
;
}
2013-05-31 10:34:02 +00:00
for (int var7 = 0; var7 < 128; ++var7)
{
int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
int var99 = par2Random.nextInt(6);
2013-05-31 10:34:02 +00:00
if (par1World.isAirBlock(var8, var9, var10) && par1World.getBlockId(var8, var9 - 1, var10) == Block.netherrack.blockID)
{
par1World.setBlock(var8, var9 - 1, var10, Block.grass.blockID, 0, 2);
if (var99 == 0)
{
par1World.setBlock(var8, var9, var10, Block.mushroomRed.blockID, 0, 2);
}
2013-05-31 10:34:02 +00:00
if (var99 == 1)
{
par1World.setBlock(var8, var9, var10, Block.mushroomBrown.blockID, 0, 2);
}
2013-05-31 10:34:02 +00:00
if (var99 == 2)
{
par1World.setBlock(var8, var9, var10, Block.tallGrass.blockID, 0, 2);
}
2013-05-31 10:34:02 +00:00
2013-05-21 00:49:30 +00:00
if (var99 == 3)
{
2013-05-25 23:46:48 +00:00
par1World.setBlock(var8, var9, var10, Blocks.logs4.get().blockID, 1, 2);
2013-05-21 00:49:30 +00:00
if (par1World.isAirBlock(var8, var9 + 1, var10))
{
2013-05-25 23:46:48 +00:00
par1World.setBlock(var8, var9 + 1, var10, Blocks.logs4.get().blockID, 1, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8 + 1, var9 + 1, var10))
{
par1World.setBlock(var8 + 1, var9 + 1, var10, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8 - 1, var9 + 1, var10))
{
par1World.setBlock(var8 - 1, var9 + 1, var10, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8, var9 + 1, var10 + 1))
{
par1World.setBlock(var8, var9 + 1, var10 + 1, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8, var9 + 1, var10 - 1))
{
par1World.setBlock(var8, var9 + 1, var10 - 1, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8, var9 + 2, var10))
{
par1World.setBlock(var8, var9 + 2, var10, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
}
2013-05-31 10:34:02 +00:00
2013-05-21 00:49:30 +00:00
if (var99 == 4)
{
2013-05-25 23:46:48 +00:00
par1World.setBlock(var8, var9, var10, Blocks.logs4.get().blockID, 1, 2);
2013-05-21 00:49:30 +00:00
if (par1World.isAirBlock(var8, var9 + 1, var10))
{
2013-05-25 23:46:48 +00:00
par1World.setBlock(var8, var9 + 1, var10, Blocks.logs4.get().blockID, 1, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8 + 1, var9 + 1, var10))
{
par1World.setBlock(var8 + 1, var9 + 1, var10, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8 - 1, var9 + 1, var10))
{
par1World.setBlock(var8 - 1, var9 + 1, var10, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8, var9 + 1, var10 + 1))
{
par1World.setBlock(var8, var9 + 1, var10 + 1, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8, var9 + 1, var10 - 1))
{
par1World.setBlock(var8, var9 + 1, var10 - 1, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
if (par1World.isAirBlock(var8, var9 + 2, var10))
{
par1World.setBlock(var8, var9 + 2, var10, Blocks.leaves2.get().blockID, 4, 2);
2013-05-21 00:49:30 +00:00
}
}
2013-05-31 10:34:02 +00:00
}
}
2013-05-31 10:34:02 +00:00
return true;
}
}