From f8964d0f45232967486fd4573c5f123070e8645c Mon Sep 17 00:00:00 2001 From: Gabriel Henrique de Oliveira <17054373+GabrielOlvH@users.noreply.github.com> Date: Tue, 16 Feb 2021 12:25:53 -0300 Subject: Use Slot#getMaxItemCount(ItemStack) instead of Slot#getMaxItemCount() (#99) --- .../java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java index ce0dd4b..b275983 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java @@ -166,7 +166,7 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio ItemStack curSlotStack = slot.getStack(); if (!curSlotStack.isEmpty() && canStacksCombine(toInsert, curSlotStack) && slot.canInsert(toInsert)) { int combinedAmount = curSlotStack.getCount() + toInsert.getCount(); - int maxAmount = Math.min(toInsert.getMaxCount(), slot.getMaxItemCount()); + int maxAmount = Math.min(toInsert.getMaxCount(), slot.getMaxItemCount(toInsert)); if (combinedAmount <= maxAmount) { toInsert.setCount(0); curSlotStack.setCount(combinedAmount); @@ -186,8 +186,8 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio private boolean insertIntoEmpty(ItemStack toInsert, Slot slot) { ItemStack curSlotStack = slot.getStack(); if (curSlotStack.isEmpty() && slot.canInsert(toInsert)) { - if (toInsert.getCount() > slot.getMaxItemCount()) { - slot.setStack(toInsert.split(slot.getMaxItemCount())); + if (toInsert.getCount() > slot.getMaxItemCount(toInsert)) { + slot.setStack(toInsert.split(slot.getMaxItemCount(toInsert))); } else { slot.setStack(toInsert.split(toInsert.getCount())); } -- cgit