Bonemeal now only reacts to mangrove saplings when they are on sand

This commit is contained in:
Adubbz 2013-04-06 22:40:41 +11:00
parent ba1c173093
commit 8c1984c967
2 changed files with 22 additions and 19 deletions

View file

@ -215,13 +215,16 @@ public class BonemealUse
if (event.ID == BOPBlocks.mangroveSapling.blockID)
{
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
if (event.world.getBlockId(event.X, event.Y - 1, event.Z) == Block.sand.blockID)
{
if ((double)event.world.rand.nextFloat() < 0.45D)
event.setResult(Result.ALLOW);
if (!event.world.isRemote)
{
((BlockMangroveSapling)BOPBlocks.mangroveSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
if ((double)event.world.rand.nextFloat() < 0.45D)
{
((BlockMangroveSapling)BOPBlocks.mangroveSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
}
}
}
}