diff --git a/src/main/java/net/minestom/server/event/player/PlayerBlockInteractEvent.java b/src/main/java/net/minestom/server/event/player/PlayerBlockInteractEvent.java index e664bbd29..2ee16cf92 100644 --- a/src/main/java/net/minestom/server/event/player/PlayerBlockInteractEvent.java +++ b/src/main/java/net/minestom/server/event/player/PlayerBlockInteractEvent.java @@ -19,6 +19,7 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent private final Player.Hand hand; private final Block block; private final Point blockPosition; + private final Point cursorPosition; private final BlockFace blockFace; /** @@ -36,6 +37,7 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent this.hand = hand; this.block = block; this.blockPosition = blockPosition; + this.cursorPosition = cursorPosition; this.blockFace = blockFace; } @@ -48,6 +50,11 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent return blocksItemUse; } + /** + * Sets the blocking item use state of this event + * Note: If this is true, then no {@link PlayerUseItemOnBlockEvent} will be fired. + * @param blocks - true to block item interactions, false to not block + */ public void setBlockingItemUse(boolean blocks) { this.blocksItemUse = blocks; } @@ -66,6 +73,12 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent return blockPosition; } + /** + * Gets the cursor position of the interacted block + * @return the cursor position of the interaction + */ + public @NotNull Point getCursorPosition() { return cursorPosition; } + /** * Gets the hand used for the interaction. *