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
|
2024-08-24 11:07:12 +02:00
|
|
|
index 1c8a08e317591413426285874de74f4de54efa07..542a5501ac94f57810d34e0f769a9a7855604f91 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
|
2024-08-24 11:07:12 +02:00
|
|
|
@@ -495,15 +495,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
2021-09-22 19:40:45 +02:00
|
|
|
|
|
|
|
if (itemstack1.isEmpty()) {
|
|
|
|
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
|
2024-01-19 13:22:30 +01:00
|
|
|
+ ItemStack leftover = ItemStack.EMPTY; // Paper - Make hoppers respect inventory max stack size
|
2021-09-22 19:40:45 +02:00
|
|
|
if (!stack.isEmpty() && stack.getCount() > to.getMaxStackSize()) {
|
2024-01-19 13:22:30 +01:00
|
|
|
+ leftover = stack; // Paper - Make hoppers respect inventory max stack size
|
2021-09-22 19:40:45 +02:00
|
|
|
stack = stack.split(to.getMaxStackSize());
|
|
|
|
}
|
|
|
|
// Spigot end
|
|
|
|
to.setItem(slot, stack);
|
|
|
|
- stack = ItemStack.EMPTY;
|
2024-01-19 13:22:30 +01:00
|
|
|
+ stack = leftover; // Paper - Make hoppers respect inventory max stack size
|
2021-08-07 02:35:42 +02:00
|
|
|
flag = true;
|
|
|
|
} else if (HopperBlockEntity.canMergeItems(itemstack1, stack)) {
|
|
|
|
- int j = stack.getMaxStackSize() - itemstack1.getCount();
|
2024-01-19 13:22:30 +01:00
|
|
|
+ int j = Math.min(stack.getMaxStackSize(), to.getMaxStackSize()) - itemstack1.getCount(); // Paper - Make hoppers respect inventory max stack size
|
2021-08-07 02:35:42 +02:00
|
|
|
int k = Math.min(stack.getCount(), j);
|
|
|
|
|
|
|
|
stack.shrink(k);
|