3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

SPIGOT-1993: Move hand check to proper location

Dieser Commit ist enthalten in:
md_5 2016-03-20 16:53:36 +11:00
Ursprung 622014a3b4
Commit c91d092bcd

Datei anzeigen

@ -226,7 +226,7 @@
if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) { if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) {
TileEntity tileentity = world.getTileEntity(blockposition); TileEntity tileentity = world.getTileEntity(blockposition);
@@ -329,6 +464,74 @@ @@ -329,6 +464,72 @@
return itemstack.placeItem(entityhuman, world, blockposition, enumhand, enumdirection, f, f1, f2); return itemstack.placeItem(entityhuman, world, blockposition, enumhand, enumdirection, f, f1, f2);
} }
} }
@ -239,8 +239,6 @@
+ if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) { + if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) {
+ TileEntity tileentity = world.getTileEntity(blockposition); + TileEntity tileentity = world.getTileEntity(blockposition);
+ cancelledBlock = !(tileentity instanceof ITileInventory || tileentity instanceof IInventory); + cancelledBlock = !(tileentity instanceof ITileInventory || tileentity instanceof IInventory);
+ } else {
+ cancelledBlock = !(!entityhuman.isSneaking() || entityhuman.getItemInMainHand() == null && entityhuman.getItemInOffHand() == null); // From above
+ } + }
+ +
+ if (!entityhuman.getBukkitEntity().isOp() && itemstack != null && Block.asBlock(itemstack.getItem()) instanceof BlockCommand) { + if (!entityhuman.getBukkitEntity().isOp() && itemstack != null && Block.asBlock(itemstack.getItem()) instanceof BlockCommand) {
@ -279,7 +277,7 @@
+ } + }
+ +
+ return EnumInteractionResult.PASS; + return EnumInteractionResult.PASS;
+ } else if (!entityhuman.isSneaking() || itemstack == null) { + } else if (!entityhuman.isSneaking() || entityhuman.getItemInMainHand() == null && entityhuman.getItemInOffHand() == null) {
+ result = blockdata.getBlock().interact(world, blockposition, blockdata, entityhuman, enumhand, itemstack, enumdirection, f, f1, f2) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS; + result = blockdata.getBlock().interact(world, blockposition, blockdata, entityhuman, enumhand, itemstack, enumdirection, f, f1, f2) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
+ } + }
+ +