Use the stack-aware version of Slot#getMaxItemCount

This commit is contained in:
Sollace 2022-09-21 10:53:09 +02:00
parent 32a23a6ca5
commit ac874945cd

View file

@ -249,7 +249,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
if (!current.isEmpty() && ItemStack.canCombine(stack, current)) {
// abide by the slot's max item count when trying to insert stacks
int available = Math.min(Math.min(current.getMaxCount(), slot.getMaxItemCount()) - current.getCount(), stack.getCount());
int available = Math.min(Math.min(current.getMaxCount(), slot.getMaxItemCount(stack)) - current.getCount(), stack.getCount());
if (available > 0) {
current.increment(available);