diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-06-19 01:44:57 -0400 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-06-19 04:25:57 -0400 |
commit | a6e5c9722313cad63802559bd0a568911371f28c (patch) | |
tree | d47ee62dfd1ab360bbc5cef34f0ec4066ed541b4 /src/main | |
parent | 12b7499c4f0d66e4daa77484ca87f94b6e64fd7a (diff) | |
download | craftbukkit-a6e5c9722313cad63802559bd0a568911371f28c.tar craftbukkit-a6e5c9722313cad63802559bd0a568911371f28c.tar.gz craftbukkit-a6e5c9722313cad63802559bd0a568911371f28c.tar.lz craftbukkit-a6e5c9722313cad63802559bd0a568911371f28c.tar.xz craftbukkit-a6e5c9722313cad63802559bd0a568911371f28c.zip |
Fixed losing an infinite item when interacting with an entity. Thanks for the help Rigby!
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityHuman.java | 6 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 5feff7a7..88dbc4e7 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -512,7 +512,8 @@ public abstract class EntityHuman extends EntityLiving { if (itemstack != null && entity instanceof EntityLiving) { itemstack.a((EntityLiving) entity); - if (itemstack.count <= 0) { + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0) { itemstack.a(this); this.G(); } @@ -573,7 +574,8 @@ public abstract class EntityHuman extends EntityLiving { if (itemstack != null && entity instanceof EntityLiving) { itemstack.a((EntityLiving) entity, this); - if (itemstack.count <= 0) { + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0) { itemstack.a(this); this.G(); } diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index fb9ec17c..52d0995c 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -869,8 +869,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } // CraftBukkit end this.player.c(entity); + // CraftBukkit start - update the client if the item is an infinite one + if (this.player.inventory.getItemInHand().count <= -1) { + this.player.a(this.player.activeContainer); + } + // CraftBukkit end } else if (packet7useentity.c == 1) { this.player.d(entity); + // CraftBukkit start - update the client if the item is an infinite one + if (this.player.inventory.getItemInHand().count <= -1) { + this.player.a(this.player.activeContainer); + } + // CraftBukkit end } } } |