diff options
author | Gabriel Henrique de Oliveira <17054373+GabrielOlvH@users.noreply.github.com> | 2021-02-16 12:25:53 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 17:25:53 +0200 |
commit | f8964d0f45232967486fd4573c5f123070e8645c (patch) | |
tree | 22e099af9c65b2c423dba3bb9c66e2056719cdd1 /src/main | |
parent | b8ddfe1663ab9f6534e76dfe4fd13194bd31f0b9 (diff) | |
download | LibGui-f8964d0f45232967486fd4573c5f123070e8645c.tar.gz LibGui-f8964d0f45232967486fd4573c5f123070e8645c.tar.bz2 LibGui-f8964d0f45232967486fd4573c5f123070e8645c.zip |
Use Slot#getMaxItemCount(ItemStack) instead of Slot#getMaxItemCount() (#99)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java | 6 |
1 files 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())); } |