diff --git a/src/main/java/gregtech/common/tools/ToolUtility.java b/src/main/java/gregtech/common/tools/ToolUtility.java index 1225e6e445..35fa75a0bf 100644 --- a/src/main/java/gregtech/common/tools/ToolUtility.java +++ b/src/main/java/gregtech/common/tools/ToolUtility.java @@ -42,6 +42,8 @@ public static boolean applyTimberAxe(ItemStack itemStack, World world, BlockPos if(TreeChopTask.isLogBlock(blockState) == 1) { if(!world.isRemote) { EntityPlayerMP playerMP = (EntityPlayerMP) player; + if (playerMP.getCooldownTracker().hasCooldown(itemStack.getItem())) + return false; TreeChopTask treeChopTask = new TreeChopTask(blockPos, world, playerMP, itemStack); TaskScheduler.scheduleTask(world, treeChopTask); } diff --git a/src/main/java/gregtech/common/tools/TreeChopTask.java b/src/main/java/gregtech/common/tools/TreeChopTask.java index 1c0b359c8f..25d550a970 100644 --- a/src/main/java/gregtech/common/tools/TreeChopTask.java +++ b/src/main/java/gregtech/common/tools/TreeChopTask.java @@ -42,9 +42,11 @@ public TreeChopTask(BlockPos startPos, World world, EntityPlayerMP player, ItemS this.startBlockPos = startPos.toImmutable(); this.currentPos.setPos(startPos); this.woodBlockPos.add(startPos.toImmutable()); + this.visitedBlockPos.add(startPos.toImmutable()); this.world = world; this.itemStack = toolStack.copy(); this.player = player; + player.getCooldownTracker().setCooldown(itemStack.getItem(), 20); } @Override @@ -62,6 +64,8 @@ public boolean run() { if (toolValueItem == null) { return false; } + if (world.getTotalWorldTime() % 10 == 0) + player.getCooldownTracker().setCooldown(itemStack.getItem(), 20); IToolStats toolStats = toolValueItem.getToolStats(); int damagePerBlockBreak = toolStats.getToolDamagePerBlockBreak(itemStack); @@ -117,7 +121,6 @@ private boolean tryBreakAny() { this.world.destroyBlock(woodPos, true); return true; } - return true; } return false; }