From f8a0520f3577ca9ad182843da2aaaba0d367b663 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Thu, 4 Dec 2014 19:16:14 +0100 Subject: [PATCH] Possible fix for the endless recursions that sometimes seem to happen with AOE tools. #1213 --- .../java/tconstruct/library/tools/HarvestTool.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/tconstruct/library/tools/HarvestTool.java b/src/main/java/tconstruct/library/tools/HarvestTool.java index 27d5e73b1ad..08b850dacd7 100644 --- a/src/main/java/tconstruct/library/tools/HarvestTool.java +++ b/src/main/java/tconstruct/library/tools/HarvestTool.java @@ -311,11 +311,21 @@ protected void breakExtraBlock(World world, int x, int y, int z, int sidehit, En // following code can be found in PlayerControllerMP.onPlayerDestroyBlock world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - if(block.removedByPlayer(world, player, x,y,z)) + if(block.removedByPlayer(world, player, x,y,z, true)) { block.onBlockDestroyedByPlayer(world, x,y,z, meta); } - pcmp.onPlayerDestroyBlock(x, y, z, sidehit); + // callback to the tool + ItemStack itemstack = player.getCurrentEquippedItem(); + if (itemstack != null) + { + itemstack.func_150999_a(world, block, x, y, z, player); + + if (itemstack.stackSize == 0) + { + player.destroyCurrentEquippedItem(); + } + } // send an update to the server, so we get an update back if(PHConstruct.extraBlockUpdates)