Skip to content

Commit

Permalink
Fix miscalculation of max parallel by output for non-64 stacked items (
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungOnionMC authored Nov 11, 2024
1 parent d98f0b9 commit c0847a7
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ public int insertStackedItemStack(@NotNull ItemStack stack, int amountToInsert)
initSlot(i);
// if it's the same item or there is no item in the slot
ItemStack slotKey = this.slots[i].getItemStack();
if (slotKey.isEmpty() || ItemStackHashStrategy.comparingAllButCount().equals(slotKey, stack)) {
if (slotKey.isEmpty() || ItemStack.isSameItemSameTags(slotKey, stack)) {
// if the slot is not full
int canInsertUpTo = this.slots[i].getSlotLimit() - this.slots[i].getCount();
int canInsertUpTo = Math.min(this.slots[i].getSlotLimit() - this.slots[i].getCount(),
stack.getMaxStackSize());
if (canInsertUpTo > 0) {
int insertedAmount = Math.min(canInsertUpTo, amountToInsert);
this.slots[i].setItemStack(stack.copy()); // this copy may not be need, needs further tests
Expand Down Expand Up @@ -139,7 +140,7 @@ public ItemStack getItemStack() {
}

public void setItemStack(@NotNull ItemStack itemStack) {
if (!ItemStackHashStrategy.comparingAllButCount().equals(this.itemStack, itemStack)) {
if (!ItemStack.isSameItemSameTags(this.itemStack, itemStack)) {
this.itemStack = itemStack;
this.slotLimit = Math.min(itemStack.getMaxStackSize(), slotLimit);
}
Expand Down

0 comments on commit c0847a7

Please sign in to comment.