Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
31 Zeilen
1.8 KiB
Diff
31 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
|
|
index 8aabefdcbeb3fc5fb7d11fe04ee629fe7bc612c2..4dda44608320c2a872b23053a1c3de63b79741c2 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
|
|
@@ -438,15 +438,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
if (itemstack1.isEmpty()) {
|
|
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
|
|
+ ItemStack leftover = ItemStack.EMPTY; // Paper - Make hoppers respect inventory max stack size
|
|
if (!stack.isEmpty() && stack.getCount() > to.getMaxStackSize()) {
|
|
+ leftover = stack; // Paper - Make hoppers respect inventory max stack size
|
|
stack = stack.split(to.getMaxStackSize());
|
|
}
|
|
// Spigot end
|
|
to.setItem(slot, stack);
|
|
- stack = ItemStack.EMPTY;
|
|
+ stack = leftover; // Paper - Make hoppers respect inventory max stack size
|
|
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 - Make hoppers respect inventory max stack size
|
|
int k = Math.min(stack.getCount(), j);
|
|
|
|
stack.shrink(k);
|