diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-03-24 23:27:40 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-03-24 23:27:40 +0100 |
commit | f330025f1fc00eaaa39a4493a7e13a5394d99fd1 (patch) | |
tree | 2a06f52014fd09d0f08cfc14a23416e0341005e2 /src/main/java/net/minecraft | |
parent | 92518f4fc06a46cd67869224e11fe426c280b952 (diff) | |
download | craftbukkit-f330025f1fc00eaaa39a4493a7e13a5394d99fd1.tar craftbukkit-f330025f1fc00eaaa39a4493a7e13a5394d99fd1.tar.gz craftbukkit-f330025f1fc00eaaa39a4493a7e13a5394d99fd1.tar.lz craftbukkit-f330025f1fc00eaaa39a4493a7e13a5394d99fd1.tar.xz craftbukkit-f330025f1fc00eaaa39a4493a7e13a5394d99fd1.zip |
Fixed unable to eat/throw
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemInWorldManager.java | 6 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 17 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index 7cd5f3a1..0dbbe80a 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -185,6 +185,12 @@ public class ItemInWorldManager { public boolean a(EntityHuman entityhuman, World world, ItemStack itemstack) { int i = itemstack.count; + + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_AIR, itemstack); + if (event.useItemInHand() == Event.Result.DENY) { + return false; + } + ItemStack itemstack1 = itemstack.a(world, entityhuman); if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) { diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index bc6bc060..f8520e4c 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -17,6 +17,7 @@ import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Player; +import org.bukkit.event.Event; import org.bukkit.event.Event.Type; import org.bukkit.event.block.*; import org.bukkit.event.player.*; @@ -410,17 +411,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } // CraftBukkit start - PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.e, Action.RIGHT_CLICK_AIR, itemstack); + int itemstackAmount = itemstack.count; + this.e.c.a(this.e, this.e.world, itemstack); - if (!event.isCancelled()) { - int itemstackAmount = itemstack.count; - this.e.c.a(this.e, this.e.world, itemstack); - - // CraftBukkit notch decrements the counter by 1 in the above method with food, - // snowballs and so forth, but he does it in a place that doesn't cause the - // inventory update packet to get sent - always = (itemstack.count != itemstackAmount); - } + // CraftBukkit notch decrements the counter by 1 in the above method with food, + // snowballs and so forth, but he does it in a place that doesn't cause the + // inventory update packet to get sent + always = (itemstack.count != itemstackAmount); // CraftBukkit end } else { int i = packet15place.a; |