From 21327265f0eaf112bf0927528342c8af7a8b185f Mon Sep 17 00:00:00 2001 From: md_5 <md_5@bigpond.com> Date: Wed, 23 May 2012 16:04:17 +1000 Subject: [PATCH] [Bleeding] Improve handling of ItemStacks. Addresses BUKKIT-1697 --- src/main/java/net/minecraft/server/Container.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java index c190fee45c..5b7058bfeb 100644 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -119,7 +119,11 @@ public abstract class Container { } if (j == 1) { - entityhuman.drop(playerinventory.getCarried().a(1)); + // CraftBukkit start + if (playerinventory.getCarried().count > 0) { + entityhuman.drop(playerinventory.getCarried().a(1)); + } + // CraftBukkit end if (playerinventory.getCarried().count == 0) { playerinventory.setCarried((ItemStack) null); } @@ -162,8 +166,11 @@ public abstract class Container { if (l > slot1.a()) { l = slot1.a(); } - - slot1.set(itemstack3.a(l)); + // CraftBukkit start + if (itemstack3.count >= l) { + slot1.set(itemstack3.a(l)); + } + // CraftBukkit end if (itemstack3.count == 0) { playerinventory.setCarried((ItemStack) null); }