aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0223-Avoid-item-merge-if-stack-size-above-max-stack-size.patch
blob: ef92cd2b92b3c753808da5dd865ecc63ec1c83ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
From 0000000000000000000000000000000000000000 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/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 54025e401eb02fceb47afb182f0ede620ca23a8d..0741dcbd06395b4696eb6083128a5d9b679cb3fb 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -223,6 +223,10 @@ public class ItemEntity extends Entity {
 
     private void mergeWithNeighbours() {
         if (this.isMergable()) {
+            // Paper start - avoid item merge if stack size above max stack size
+            ItemStack stack = getItem();
+            if (stack.getCount() >= stack.getMaxStackSize()) return;
+            // Paper end
             // Spigot start
             double radius = level.spigotConfig.itemMerge;
             List<ItemEntity> list = this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(radius, radius, radius), (entityitem) -> {