3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 19:40:07 +01:00
Paper/patches/unapplied/server/0668-Make-hoppers-respect-inventory-max-stack-size.patch

33 Zeilen
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
2023-02-23 17:37:56 +01:00
index eedc9fa0bcd30af3b229d74cfdfeffed4b60f221..d76603c4172aa10889949c6c2acff05fee02a13d 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
2023-02-23 17:37:56 +01:00
@@ -596,17 +596,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
2023-02-23 17:37:56 +01:00
ignoreTileUpdates = true; // Paper
to.setItem(slot, stack);
2023-02-23 17:37:56 +01:00
ignoreTileUpdates = 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);