From c28c88eb357d99f28e89f4dfed6bc38175e8fada Mon Sep 17 00:00:00 2001 From: Aikar <aikar@aikar.co> Date: Wed, 14 Feb 2018 21:30:12 -0500 Subject: [PATCH] Fix bug with hopper optimizations when amount > 3 - Closes #1011 --- Spigot-Server-Patches/Optimize-Hoppers.patch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Spigot-Server-Patches/Optimize-Hoppers.patch b/Spigot-Server-Patches/Optimize-Hoppers.patch index 135942dc48..c56eaf9c05 100644 --- a/Spigot-Server-Patches/Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/Optimize-Hoppers.patch @@ -60,7 +60,7 @@ index 8e2d55a73..fe2df18df 100644 this.g = iblockdata.getBlock().toLegacyData(iblockdata); diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index e9315f2d5..6ec292714 100644 +index e9315f2d5..5198a590a 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @@ -94,11 +94,11 @@ index e9315f2d5..6ec292714 100644 + return false; + } + } -+ final ItemStack itemstack1 = addItem(this, iinventory, itemstack, enumdirection); -+ -+ if (itemstack1.isEmpty()) { ++ final ItemStack itemstack2 = addItem(this, iinventory, itemstack, enumdirection); ++ final int remaining = itemstack2.getCount(); ++ if (remaining != moved) { + origItemStack = origItemStack.cloneItemStack(); -+ origItemStack.setCount(origCount - moved); ++ origItemStack.setCount(origCount - moved + remaining); + this.setItem(i, origItemStack); + iinventory.update(); + return true; @@ -132,9 +132,10 @@ index e9315f2d5..6ec292714 100644 + } + + final ItemStack itemstack2 = addItem(iinventory, ihopper, itemstack, null); -+ if (itemstack2.isEmpty()) { ++ final int remaining = itemstack2.getCount(); ++ if (remaining != moved) { + origItemStack = origItemStack.cloneItemStack(); -+ origItemStack.setCount(origCount - moved); ++ origItemStack.setCount(origCount - moved + remaining); + IGNORE_TILE_UPDATES = true; + iinventory.setItem(i, origItemStack); + IGNORE_TILE_UPDATES = false;