summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/minecraft/server/ItemInWorldManager.java11
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java5
2 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java
index 0dbbe80a..14c0b379 100644
--- a/src/main/java/net/minecraft/server/ItemInWorldManager.java
+++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java
@@ -186,11 +186,6 @@ 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)) {
@@ -220,10 +215,14 @@ public class ItemInWorldManager {
}
} else {
result = Block.byId[i1].a(world, i, j, k, entityhuman);
+ if (itemstack != null && !result) {
+ result = itemstack.a(entityhuman, world, i, j, k, l);
+ }
}
+
// If we have 'true' and no explicit deny *or* an explicit allow -- run the item part of the hook
if (itemstack != null && ((!result && event.useItemInHand() != Event.Result.DENY) || event.useItemInHand() == Event.Result.ALLOW)) {
- result = itemstack.a(entityhuman, world, i, j, k, l);
+ this.a(entityhuman, world, itemstack);
}
}
return result;
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index f8520e4c..254c682d 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -412,7 +412,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start
int itemstackAmount = itemstack.count;
- this.e.c.a(this.e, this.e.world, itemstack);
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.e, Action.RIGHT_CLICK_AIR, itemstack);
+ if (event.useItemInHand() != Event.Result.DENY) {
+ 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