BiomesOPlenty/src/minecraft/tdwp_ftw/biomesop/worldgen/WorldGenSpire.java
Amnet f1e6102888 Refactored code a little - moved stuff around/removed some
warnings/changed some names.
Corrected Forestry Integration part.
2013-04-10 17:13:12 +02:00

125 lines
5 KiB
Java

package tdwp_ftw.biomesop.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import tdwp_ftw.biomesop.configuration.BOPBlocks;
public class WorldGenSpire extends WorldGenerator
{
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
int var6;
for (var6 = 6; par1World.getBlockMaterial(par3, par4 - 1, par5) == Material.water; --par4)
{
;
}
boolean var7 = true;
if (par4 >= 1 && par4 + var6 + 1 <= 71)
{
int var8;
int var10;
int var11;
int var12;
for (var8 = par4; var8 <= par4 + 1 + var6; ++var8)
{
byte var9 = 1;
if (var8 == par4)
{
var9 = 0;
}
if (var8 >= par4 + 1 + var6 - 2)
{
var9 = 3;
}
for (var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10)
{
for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11)
{
if (var8 >= 0 && var8 < 128)
{
var12 = par1World.getBlockId(var10, var8, var11);
if (var12 != 0 && var12 != BOPBlocks.willowLeaves.blockID)
{
if (var12 != Block.waterStill.blockID && var12 != Block.waterMoving.blockID)
{
var7 = false;
}
}
}
else
{
var7 = false;
}
}
}
}
if (!var7)
{
return false;
}
else
{
var8 = par1World.getBlockId(par3, par4 - 1, par5);
if ((var8 == BOPBlocks.driedDirt.blockID) && par4 < 128 - var6 - 1)
{
this.setBlock(par1World, par3 - 1, par4, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 + 1, par4, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4, par5 - 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4, par5 + 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 - 1, par4 + 1, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 + 1, par4 + 1, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 1, par5 - 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 1, par5 + 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 - 1, par4 + 2, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 + 1, par4 + 2, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 2, par5 - 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 2, par5 + 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 - 1, par4 + 3, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 + 1, par4 + 3, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 3, par5 - 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 3, par5 + 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 - 1, par4 + 4, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3 + 1, par4 + 4, par5, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 4, par5 - 1, BOPBlocks.driedDirt.blockID);
this.setBlock(par1World, par3, par4 + 4, par5 + 1, BOPBlocks.driedDirt.blockID);
int var13;
int var16;
for (var16 = 0; var16 < var6; ++var16)
{
var10 = par1World.getBlockId(par3, par4 + var16, par5);
if (var10 == 0 || var10 == BOPBlocks.willowLeaves.blockID || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID)
{
this.setBlock(par1World, par3, par4 + var16, par5, BOPBlocks.driedDirt.blockID);
}
}
return true;
}
else
{
return false;
}
}
}
else
{
return false;
}
}
}