Skip to content

Commit

Permalink
fix oversight in ItemHandlerList
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Feb 13, 2025
1 parent aabe723 commit 4018512
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ public int getSlots() {
public void setStackInSlot(int slot, @NotNull ItemStack stack) {
if (invalidSlot(slot)) return;
IItemHandler itemHandler = handlerBySlotIndex.get(slot);
int actualSlot = slot - baseIndexOffset.get(itemHandler);
if (itemHandler instanceof IItemHandlerModifiable modifiable) {
modifiable.setStackInSlot(slot - baseIndexOffset.get(itemHandler), stack);
modifiable.setStackInSlot(actualSlot, stack);
} else {
itemHandler.extractItem(slot, Integer.MAX_VALUE, false);
itemHandler.insertItem(slot, stack, false);
itemHandler.extractItem(actualSlot, Integer.MAX_VALUE, false);
itemHandler.insertItem(actualSlot, stack, false);
}
}

Expand Down

0 comments on commit 4018512

Please sign in to comment.