From 1c677c109959dcdab6583f311f901a6e679979cd Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:23:47 -0700 Subject: [PATCH] allow cache miss to set any stack it comes across, instead of just the one we want --- .../storage/CraftingRecipeLogic.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java index c99a824bf54..457b2e421f3 100644 --- a/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java +++ b/src/main/java/gregtech/common/metatileentities/storage/CraftingRecipeLogic.java @@ -388,14 +388,16 @@ public int handleCacheMiss(ItemStack stack) { var curStack = this.availableHandlers.getStackInSlot(i); if (curStack.isEmpty()) continue; + Set slots; + if (stackLookupMap.containsKey(stack)) + slots = stackLookupMap.get(stack); + else { + stackLookupMap.put(stack.copy(), slots = new IntArraySet()); + } + slots.add(i); + if (this.strategy.equals(stack, curStack)) { - Set slots; - if (stackLookupMap.containsKey(stack)) - slots = stackLookupMap.get(stack); - else { - stackLookupMap.put(stack.copy(), slots = new IntArraySet()); - } - if (slots.add(i)) return i; + return i; } } return -1;