mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-20 14:53:49 -07:00
SPIGOT-1608: Add a way to get the hand used in PlayerInteract*Events
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
|
||||
public void a(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand());
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Let the client know the block still exists
|
||||
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
@@ -245,7 +245,7 @@
|
||||
+ cancelledBlock = true;
|
||||
+ }
|
||||
+
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, blockposition, enumdirection, itemstack, cancelledBlock);
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, blockposition, enumdirection, itemstack, cancelledBlock, enumhand);
|
||||
+ firedInteract = true;
|
||||
+ interactResult = event.useItemInHand() == Event.Result.DENY;
|
||||
+
|
||||
|
Reference in New Issue
Block a user