2021-08-07 02:35:42 +02:00
|
|
|
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
|
2022-07-03 23:55:56 +02:00
|
|
|
index a7ac6b528aecae528a17af157f8ec29371e4484c..ccad692aba2ed77259f6814d88f01b91ed9d229b 100644
|
2021-08-07 02:35:42 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
2022-06-08 11:31:06 +02:00
|
|
|
@@ -586,17 +586,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
2021-09-22 19:40:45 +02:00
|
|
|
|
|
|
|
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
|
2021-08-07 02:35:42 +02:00
|
|
|
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);
|