From be81afac4fa9c531b229bc90687acdce12bc1484 Mon Sep 17 00:00:00 2001 From: J3H Date: Mon, 9 Jan 2017 20:15:17 +0100 Subject: [PATCH] Fix duplication bug caused by oversized item stacks --- .../betterenderchest/eventhandler/BetterEnderSlotsHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/nl/rutgerkok/betterenderchest/eventhandler/BetterEnderSlotsHandler.java b/src/main/java/nl/rutgerkok/betterenderchest/eventhandler/BetterEnderSlotsHandler.java index c5e164c..1c710fb 100644 --- a/src/main/java/nl/rutgerkok/betterenderchest/eventhandler/BetterEnderSlotsHandler.java +++ b/src/main/java/nl/rutgerkok/betterenderchest/eventhandler/BetterEnderSlotsHandler.java @@ -134,6 +134,8 @@ protected void handleTakeOnlySlotsShiftClick(InventoryClickEvent event) { // Calculate how many will fit int itemsToAdd = Math.min(inventory.getMaxStackSize(), inSlot.getMaxStackSize()) - inSlot.getAmount(); + + itemsToAdd = Math.max(itemsToAdd, 0); // Limit that by how many we actually have itemsToAdd = Math.min(adding.getAmount(), itemsToAdd);