Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/gregtech/common/tools/ToolUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/gregtech/common/tools/TreeChopTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down Expand Up @@ -117,7 +121,6 @@ private boolean tryBreakAny() {
this.world.destroyBlock(woodPos, true);
return true;
}
return true;
}
return false;
}
Expand Down