}
public void growTree(World world, int x, int y, int z, Random rand)
{
final int metadata = unmarkedMetadata(world.getBlockMetadata(x, y, z));
WorldGenerator tree = null;
int x1 = 0;
int z1 = 0;
boolean isHuge = false;
int offset = 0;
final boolean isForestryFarmed = world.getBlock(x, y - 1, z) == forestrySoil;
if (metadata == BlockType.UMBER.metadata())
{
if (rand.nextInt(3) != 0)
{
tree = new WorldGenBigAutumnTree(true, AutumnTreeType.BROWN);
WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
else
{
tree = new WorldGenAutumnTree(true, AutumnTreeType.BROWN);
WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
}
else if (metadata == BlockType.GOLDENROD.metadata())
{
if (rand.nextInt(3) != 0)
{
tree = new WorldGenBigAutumnTree(true, AutumnTreeType.ORANGE);
WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
else
{
tree = new WorldGenAutumnTree(true, AutumnTreeType.ORANGE);
WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
}
else if (metadata == BlockType.VERMILLION.metadata())
{
if (rand.nextInt(3) != 0)
{
tree = new WorldGenBigAutumnTree(true, AutumnTreeType.PURPLE);
WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
else
{
tree = new WorldGenAutumnTree(true, AutumnTreeType.PURPLE);
WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
}
else if (metadata == BlockType.CITRINE.metadata())
{
if (rand.nextInt(3) != 0)
{
tree = new WorldGenBigAutumnTree(true, AutumnTreeType.YELLOW);
WorldGenBigAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
else
{
tree = new WorldGenAutumnTree(true, AutumnTreeType.YELLOW);
WorldGenAutumnTree.setTrunkBlock(Block.getBlockFromItem(Element.LOG_AUTUMN.get().getItem()), Element.LOG_AUTUMN.get().getItemDamage());
}
}
else if (metadata == BlockType.ACACIA.metadata())
{
tree = new WorldGenAcacia(true);
}
else if (metadata == BlockType.CYPRESS.metadata())
{
tree = new WorldGenCypressTree(true);
}
else
{
// Check for 2x2 firs and redwoods
for (x1 = 0; x1 >= -1; --x1)
{
for (z1 = 0; z1 >= -1; --z1)
if (isSameSapling(world, x + x1, y, z + z1, metadata) && isSameSapling(world, x + x1 + 1, y, z + z1, metadata) && isSameSapling(world, x + x1, y, z + z1 + 1, metadata) && isSameSapling(world, x + x1 + 1, y, z + z1 + 1, metadata))
{
if (metadata == BlockType.FIR.metadata())
{
tree = new WorldGenFirTreeHuge(true);
offset = 1;
}
else
{
tree = GeneralSettings.useLegacyRedwoods ? new WorldGenRedwood(true) : new WorldGenNewRedwood(true);
offset = 0;
}
isHuge = true;
break;
}
if (tree != null)
break;
}
if (tree == null && metadata == BlockType.FIR.metadata())
{
// Single fir sapling generates 1x1 tree
z1 = 0;
x1 = 0;
tree = new WorldGenFirTree(true);
}
}
if (tree != null)
{
if (isHuge)
{
world.setBlock(x + x1, y, z + z1, Blocks.air);
world.setBlock(x + x1 + 1, y, z + z1, Blocks.air);
world.setBlock(x + x1, y, z + z1 + 1, Blocks.air);
world.setBlock(x + x1 + 1, y, z + z1 + 1, Blocks.air);
}
else
world.setBlock(x, y, z, Blocks.air);
if (!tree.generate(world, rand, x + x1 + offset, y, z + z1 + offset))
{
if (isHuge)
{
world.setBlock(x + x1, y, z + z1, this, metadata, 3);
world.setBlock(x + x1 + 1, y, z + z1, this, metadata, 3);