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

SPIGOT-1984: Fix default interact state when sneaking

Dieser Commit ist enthalten in:
md_5 2016-03-20 13:48:21 +11:00
Ursprung 6cac62c64d
Commit 622014a3b4

Datei anzeigen

@ -226,11 +226,11 @@
if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) {
TileEntity tileentity = world.getTileEntity(blockposition);
@@ -329,6 +464,72 @@
@@ -329,6 +464,74 @@
return itemstack.placeItem(entityhuman, world, blockposition, enumhand, enumdirection, f, f1, f2);
}
}
+ // Interract event */
+ // Interact event */
+ IBlockData blockdata = world.getType(blockposition);
+ EnumInteractionResult result = EnumInteractionResult.FAIL;
+ if (blockdata.getBlock() != Blocks.AIR) {
@ -239,6 +239,8 @@
+ if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+ 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) {