From ae911e8b400d8c593a6ee17905ce629721916f8d Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Sat, 24 Apr 2021 00:36:36 +0200 Subject: [PATCH] Fix itemstack growth bug for merging --- src/dev/w1zzrd/invtweaks/command/SortCommandExecutor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dev/w1zzrd/invtweaks/command/SortCommandExecutor.java b/src/dev/w1zzrd/invtweaks/command/SortCommandExecutor.java index 9f74fa1..4411c4f 100644 --- a/src/dev/w1zzrd/invtweaks/command/SortCommandExecutor.java +++ b/src/dev/w1zzrd/invtweaks/command/SortCommandExecutor.java @@ -142,12 +142,14 @@ public class SortCommandExecutor implements CommandExecutor { } else { final int currentAmount = current.getAmount(); - if (current.getAmount() < current.getMaxStackSize()) { - final int newAmount = Math.min(currentAmount + amount, current.getMaxStackSize()); + if (currentAmount < current.getMaxStackSize()) { + final int newAmount = Math.min(amount, current.getMaxStackSize()); current.setAmount(newAmount); // Update remaining count of given material - count.put(key, amount - (newAmount - currentAmount)); + count.put(key, amount - newAmount); + } else { + count.put(key, amount - currentAmount); } } } else {