Skip to content

Commit

Permalink
Fix index in ItemHandlerCopySlot#setStackCopy
Browse files Browse the repository at this point in the history
The current code is using `index`, which is `this.index`, which ends up as `Slot#index`. That is not correct as that index is the index of the slot inside the menu, not inside the item handler. The correct index to use is that of `SlotItemHandler` (the name is the same as the one in the root `Slot`, but the class has access to it as it's protected and we're accessing across the same package)
  • Loading branch information
Matyrobbrt committed Dec 27, 2024
1 parent 2a0abf9 commit bf9055a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected ItemStack getStackCopy() {

@Override
protected void setStackCopy(ItemStack stack) {
((IItemHandlerModifiable) slotItemHandler.getItemHandler()).setStackInSlot(index, stack);
((IItemHandlerModifiable) slotItemHandler.getItemHandler()).setStackInSlot(slotItemHandler.index, stack);
}

@Override
Expand Down

0 comments on commit bf9055a

Please sign in to comment.