SPIGOT-162: Fix cancelling RIGHT_CLICK_BLOCK not cancelling used items

This commit is contained in:
Thinkofdeath
2014-12-09 09:38:52 +00:00
parent a6465002bf
commit cf5a502fd4
2 changed files with 41 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerInteractManager.java 2014-11-28 23:05:41.725278672 +0000
+++ src/main/java/net/minecraft/server/PlayerInteractManager.java 2014-11-28 22:57:12.389289000 +0000
--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerInteractManager.java 2014-12-09 09:38:37.363833006 +0000
+++ src/main/java/net/minecraft/server/PlayerInteractManager.java 2014-12-09 09:38:31.515833135 +0000
@@ -1,5 +1,13 @@
package net.minecraft.server;
@@ -202,15 +202,19 @@
return flag;
}
@@ -268,6 +394,7 @@
@@ -266,8 +392,11 @@
}
}
}
+
+ public boolean interactResult = true; // CraftBukkit
public boolean interact(EntityHuman entityhuman, World world, ItemStack itemstack, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
+ /* CraftBukkit start - whole method
if (this.gamemode == EnumGamemode.SPECTATOR) {
TileEntity tileentity = world.getTileEntity(blockposition);
@@ -312,6 +439,66 @@
@@ -312,6 +441,67 @@
return itemstack.placeItem(entityhuman, world, blockposition, enumdirection, f, f1, f2);
}
}
@@ -259,6 +263,7 @@
+ result = blockdata.getBlock().interact(world, blockposition, blockdata, entityhuman, enumdirection, f, f1, f2);
+ }
+
+ interactResult = event.useItemInHand() != Event.Result.DENY;
+ if (itemstack != null && !result) {
+ int j1 = itemstack.getData();
+ int k1 = itemstack.count;