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 issues with breaking ice #1587

Merged
merged 3 commits into from
Mar 16, 2023
Merged
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
5 changes: 5 additions & 0 deletions src/main/java/gregtech/api/util/function/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
@FunctionalInterface
public interface Task {

/**
* Run the actions of this Task. Will be infinitely run each world tick until false is returned.
*
* @return {@code true} if the task should be run again, otherwise {@code false}
*/
boolean run();

}
5 changes: 3 additions & 2 deletions src/main/java/gregtech/common/ToolEventHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static void onHarvestDrops(@Nonnull BlockEvent.HarvestDropsEvent event) {
EntityPlayer player = event.getHarvester();
if (player != null) {
ItemStack stack = player.getHeldItemMainhand();
if (!stack.hasTagCompound() || !(stack.getItem() instanceof IGTTool)) {
if (stack.isEmpty() || !stack.hasTagCompound() || !(stack.getItem() instanceof IGTTool)) {
return;
}
if (!event.isSilkTouching()) {
Expand All @@ -122,7 +122,8 @@ public static void onHarvestDrops(@Nonnull BlockEvent.HarvestDropsEvent event) {
if (flowingState == Blocks.FLOWING_WATER.getDefaultState()) {
world.setBlockToAir(icePos);
}
return true;
// only try once, so future water placement does not get eaten too
return false;
});
}
}
Expand Down