Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small issues with forest capitator #1703

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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