diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java index ac1daed..9697c0f 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java @@ -328,6 +328,17 @@ public class CraftingModuleItem extends ModuleItem { return ItemStack.EMPTY; } + public boolean markCanceledOrResolve(PipeNetwork network) { + if (this.inProgress) { + this.canceled = true; + return false; + } else { + for (var lock : this.ingredientsToRequest) + network.resolveNetworkLock(lock); + return true; + } + } + } } diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java index 6c20dd0..cb9bba4 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/ItemTerminalBlockEntity.java @@ -216,19 +216,8 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect return; for (var craftable : network.getAllCraftables(pipe.getBlockPos())) { var otherPipe = network.getPipe(craftable.getLeft()); - if (otherPipe != null) { - otherPipe.activeCrafts.removeIf(c -> { - var data = c.getRight(); - if (data.inProgress) { - data.canceled = true; - return false; - } else { - for (var lock : data.ingredientsToRequest) - network.resolveNetworkLock(lock); - return true; - } - }); - } + if (otherPipe != null) + otherPipe.activeCrafts.removeIf(c -> c.getRight().markCanceledOrResolve(network)); } var lookingPlayers = this.getLookingPlayers(); if (lookingPlayers.length > 0)