Skip to content

Commit

Permalink
inserting item must be the same as the export slot if non-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Nov 3, 2023
1 parent 34588d9 commit 71f578e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,17 @@ public ItemStack insertItem(int slot, @Nonnull ItemStack insertedStack, boolean
return ItemStack.EMPTY;
}

// If there is a virtualized stack and the stack to insert does not match it, do not insert anything
// If there is a stack in the export slot and the stack to insert does not match it, do not insert anything
ItemStack exportItems = getExportItems().getStackInSlot(0);
if (!exportItems.isEmpty() &&
!areItemStackIdentical(exportItems, insertedStack)
) return insertedStack;

// otherwise, check virtualized inventory
if (itemsStoredInside > 0L &&
!virtualItemStack.isEmpty() && (
!areItemStackIdentical(virtualItemStack, insertedStack) ||
!areItemStackIdentical(exportItems, insertedStack))) {
!areItemStackIdentical(virtualItemStack, insertedStack)
)) {
return insertedStack;
}

Expand Down

0 comments on commit 71f578e

Please sign in to comment.