From 3b5c367699f4b1ffaa73871ece9596ae785bed1d Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 28 Aug 2020 12:26:24 +1000 Subject: [PATCH] SPIGOT-6115: Items being deleted on pick up with full inventory --- nms-patches/EntityItem.patch | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/nms-patches/EntityItem.patch b/nms-patches/EntityItem.patch index 0114d83776..bda96b6483 100644 --- a/nms-patches/EntityItem.patch +++ b/nms-patches/EntityItem.patch @@ -85,7 +85,7 @@ this.velocityChanged(); this.f = (int) ((float) this.f - f); if (this.f <= 0) { -@@ -285,6 +307,45 @@ +@@ -285,6 +307,46 @@ Item item = itemstack.getItem(); int i = itemstack.getCount(); @@ -113,12 +113,13 @@ + return; + } + -+ // Update the ItemStack incase it was changed in the event -+ itemstack = this.getItemStack(); -+ canHold = entityhuman.inventory.canHold(itemstack); -+ remaining = itemstack.getCount() - canHold; -+ -+ itemstack.setCount(canHold + remaining); // = i ++ // Update the ItemStack if it was changed in the event ++ ItemStack current = this.getItemStack(); ++ if (!itemstack.equals(current)) { ++ itemstack = current; ++ } else { ++ itemstack.setCount(canHold + remaining); // = i ++ } + + // Possibly < 0; fix here so we do not have to modify code below + this.pickupDelay = 0; @@ -131,7 +132,7 @@ if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) { entityhuman.receive(this, i); if (itemstack.isEmpty()) { -@@ -328,7 +389,9 @@ +@@ -328,7 +390,9 @@ } public void setItemStack(ItemStack itemstack) {