diff --git a/src/main/java/gregtech/api/util/function/Task.java b/src/main/java/gregtech/api/util/function/Task.java index a317c1abfb0..906d1acab3d 100644 --- a/src/main/java/gregtech/api/util/function/Task.java +++ b/src/main/java/gregtech/api/util/function/Task.java @@ -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(); } diff --git a/src/main/java/gregtech/common/ToolEventHandlers.java b/src/main/java/gregtech/common/ToolEventHandlers.java index e1b75d63da6..5919bcd2e27 100644 --- a/src/main/java/gregtech/common/ToolEventHandlers.java +++ b/src/main/java/gregtech/common/ToolEventHandlers.java @@ -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()) { @@ -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; }); } }