Paper/Spigot-Server-Patches/0253-Avoid-item-merge-if-stack-size-above-max-stack-size.patch
Spottedleaf 89a1469d3f Resolve memory leak involving TileEntities
Their chunk is set to null before removal, so we kept them around.
2019-05-14 17:19:58 -05:00

25 lines
1.0 KiB
Diff

From b4e4fa6908e7d18c22bb6975982b0abb7dac2b3e Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 16 Jul 2018 12:42:20 +0200
Subject: [PATCH] Avoid item merge if stack size above max stack size
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index bda5ea4632..ddd1f63073 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -168,6 +168,10 @@ public class EntityItem extends Entity {
}
private void mergeNearby() {
+ // Paper start - avoid item merge if stack size above max stack size
+ ItemStack stack = getItemStack();
+ if (stack.getCount() >= stack.getMaxStackSize()) return;
+ // Paper end
// Spigot start
double radius = world.spigotConfig.itemMerge;
List<EntityItem> list = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius), (entityitem) -> {
--
2.21.0