Fixed Mahogany saplings, added inner branches to reduce decay

This commit is contained in:
Adubbz 2016-02-02 23:01:11 +11:00
parent bddc74db5c
commit b8b11a0e3e
2 changed files with 26 additions and 17 deletions

View file

@ -21,6 +21,7 @@ import biomesoplenty.common.world.feature.tree.GeneratorBasicTree;
import biomesoplenty.common.world.feature.tree.GeneratorBayouTree;
import biomesoplenty.common.world.feature.tree.GeneratorBigTree;
import biomesoplenty.common.world.feature.tree.GeneratorBulbTree;
import biomesoplenty.common.world.feature.tree.GeneratorMahoganyTree;
import biomesoplenty.common.world.feature.tree.GeneratorPineTree;
import biomesoplenty.common.world.feature.tree.GeneratorRedwoodTree;
import biomesoplenty.common.world.feature.tree.GeneratorTaigaTree;
@ -199,8 +200,8 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable {
return new GeneratorBayouTree.Builder().log(BOPWoods.WILLOW).leaves(BOPTrees.WILLOW).minHeight(6).maxHeight(12).minLeavesRadius(1).leavesGradient(2).create();
case PINE:
return new GeneratorPineTree.Builder().minHeight(6).maxHeight(18).log(BOPWoods.PINE).leaves(BOPTrees.PINE).create();
case MAHOGANY: //Not implemented
return new WorldGenTrees(true);
case MAHOGANY:
return new GeneratorMahoganyTree.Builder().create();
default:
return null;
}

View file

@ -60,26 +60,26 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree
{
int endHeight = height - this.leafLayers;
for (int layer = 0; layer <= height; ++layer)
for (int layer = 0; layer <= endHeight - 3; layer++)
{
BlockPos middlePos = start.up(layer);
if (layer == endHeight - 2)
{
int branchHeight = height - endHeight - 1 + 2;
//Generate the upper branches and stop
generateBranch(world, middlePos, EnumFacing.NORTH, branchHeight);
generateBranch(world, middlePos, EnumFacing.EAST, branchHeight);
generateBranch(world, middlePos, EnumFacing.SOUTH, branchHeight);
generateBranch(world, middlePos, EnumFacing.WEST, branchHeight);
break;
}
else if (this.replace.matches(world, middlePos))
if (this.replace.matches(world, middlePos))
{
this.setLog(world, middlePos);
}
}
System.out.println(this.leafLayers);
//Generate upper branches
BlockPos branchStartPos = start.up(endHeight - 2);
int branchHeight = (this.leafLayers - 1) + 2;
generateBranch(world, branchStartPos, EnumFacing.NORTH, branchHeight);
generateBranch(world, branchStartPos, EnumFacing.EAST, branchHeight);
generateBranch(world, branchStartPos, EnumFacing.SOUTH, branchHeight);
generateBranch(world, branchStartPos, EnumFacing.WEST, branchHeight);
}
private void generateBranch(World world, BlockPos middle, EnumFacing direction, int height)
@ -88,9 +88,17 @@ public class GeneratorMahoganyTree extends GeneratorBasicTree
if (replace.matches(world, pos = middle.offset(direction))) this.setLog(world, pos, direction.getAxis());
for (int i = 1; i <= height; ++i)
for (int i = 0; i <= height - 1; i++)
{
if (replace.matches(world, pos = middle.offset(direction, 2).up(i))) this.setLog(world, pos, Axis.Y);
if (replace.matches(world, pos = middle.offset(direction, 2).up(i + 1))) this.setLog(world, pos, Axis.Y);
}
EnumFacing logDirection = direction.rotateY();
//Extend inner branches outwards to prevent decay
for (int i = -2; i <= 2; i++)
{
if (replace.matches(world, pos = middle.offset(direction, 3).offset(logDirection, i).up(height - 1))) this.setLog(world, pos, logDirection.getAxis());
}
}
}