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-03-23 22:26:17 +01:00
|
|
|
index f0b4b8eb5d2740cd73b4338fd0c2acc3b06df1f6..e3b6f2bf93710ea695b0c25c0b6968a8f24f0829 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
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -438,15 +438,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);
|