Skip to content

Commit

Permalink
allow cache miss to set any stack it comes across, instead of just th…
Browse files Browse the repository at this point in the history
…e one we want
  • Loading branch information
ghzdude committed Jan 10, 2025
1 parent b6f5738 commit 1c677c1
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,16 @@ public int handleCacheMiss(ItemStack stack) {
var curStack = this.availableHandlers.getStackInSlot(i);
if (curStack.isEmpty()) continue;

Set<Integer> 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<Integer> 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;
Expand Down

0 comments on commit 1c677c1

Please sign in to comment.