From eb15011d31c9afcf3a82200b23bacf538208aeb1 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 30 Nov 2024 19:33:34 +0100 Subject: [PATCH] clean up some dead code --- .../prettypipes/network/PipeNetwork.java | 10 +++---- .../modules/craft/CraftingModuleItem.java | 29 +++++-------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java index b6f3371..a5f02a2 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java @@ -217,6 +217,7 @@ public class PipeNetwork extends SavedData implements GraphListener(), equalityTypes).getLeft(); } @@ -286,11 +287,9 @@ public class PipeNetwork extends SavedData implements GraphListener c.moduleSlot == slot && !c.getTravelingIngredient(stack, equalityTypes).isEmpty()) - .findAny().orElse(null); - if (craft != null) { + var allCrafts = tile.getActiveCrafts(); + var ourCrafts = allCrafts.stream().filter(c -> c.moduleSlot == slot && !c.getTravelingIngredient(stack, equalityTypes).isEmpty()).iterator(); + while (ourCrafts.hasNext()) { + var craft = ourCrafts.next(); craft.travelingIngredients.remove(craft.getTravelingIngredient(stack, equalityTypes)); if (contents.insertSingles) { @@ -245,7 +230,7 @@ public class CraftingModuleItem extends ModuleItem { // if we canceled the request and all input items are delivered (ie the machine actually got what it expected), remove it from the queue if (craft.canceled) - crafts.remove(craft); + allCrafts.remove(craft); } } return stack;