Skip to content

Commit

Permalink
fix selector info max stack size check
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheaterpaul committed Jul 6, 2024
1 parent b1c358d commit 3a89903
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void setContainer(InventoryContainerMenu container) {

@Override
public int getMaxStackSize(@NotNull ItemStack stack) {
return info.stackLimit;
return Math.min(stack.getMaxStackSize(), info.stackLimit);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static void readInventoryFromTag(@NotNull CompoundTag tag, @NotNull Simpl
}

public static boolean canMergeStacks(@NotNull ItemStack stack1, @NotNull ItemStack stack2, int invLimit) {
return !stack1.isEmpty() && ItemStackUtil.stackEqualExact(stack1, stack2) && stack1.isStackable() && stack1.getCount() < stack1.getMaxStackSize() && stack1.getCount() < invLimit;
return !stack1.isEmpty() && ItemStack.isSameItemSameTags(stack1, stack2) && stack1.isStackable() && stack1.getCount() < stack1.getMaxStackSize() && stack1.getCount() < Math.min(invLimit, stack1.getMaxStackSize());
}

/**
Expand Down

0 comments on commit 3a89903

Please sign in to comment.