diff options
Diffstat (limited to 'patches/server/0697-Make-hoppers-respect-inventory-max-stack-size.patch')
-rw-r--r-- | patches/server/0697-Make-hoppers-respect-inventory-max-stack-size.patch | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/patches/server/0697-Make-hoppers-respect-inventory-max-stack-size.patch b/patches/server/0697-Make-hoppers-respect-inventory-max-stack-size.patch new file mode 100644 index 0000000000..ea86736121 --- /dev/null +++ b/patches/server/0697-Make-hoppers-respect-inventory-max-stack-size.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Wed, 7 Jul 2021 16:30:17 -0700 +Subject: [PATCH] Make hoppers respect inventory max stack size + + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +index ae680111d01470881e5dc4914cc7e8e82a463aaa..d241b25acc223982109495542fd17e0fbdf53437 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +@@ -587,17 +587,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + + if (itemstack1.isEmpty()) { + // Spigot start - SPIGOT-6693, InventorySubcontainer#setItem ++ ItemStack leftover = ItemStack.EMPTY; // Paper + if (!stack.isEmpty() && stack.getCount() > to.getMaxStackSize()) { ++ leftover = stack; // Paper + stack = stack.split(to.getMaxStackSize()); + } + // Spigot end + IGNORE_TILE_UPDATES = true; // Paper + to.setItem(slot, stack); + IGNORE_TILE_UPDATES = false; // Paper +- stack = ItemStack.EMPTY; ++ stack = leftover; // Paper + flag = true; + } else if (HopperBlockEntity.canMergeItems(itemstack1, stack)) { +- int j = stack.getMaxStackSize() - itemstack1.getCount(); ++ int j = Math.min(stack.getMaxStackSize(), to.getMaxStackSize()) - itemstack1.getCount(); // Paper + int k = Math.min(stack.getCount(), j); + + stack.shrink(k); |