Skip to content

PlayerMouseMotionEvent

Package: com.hypixel.hytale.server.core.event.events.player Extends: PlayerEvent<Void> Implements: IEvent<Void>, ICancellable Cancellable: Yes

Standard event dispatched when a player moves the mouse during a drag interaction. Provides context about the current interaction state including the item in hand, targeted block or entity, and screen coordinates.

Cancelling this event prevents the mouse motion from being processed by the server’s interaction system.

FieldTypeAccessorMutableNullable
playerRefRef<EntityStore>getPlayerRef()NoNo
playerPlayergetPlayer()NoNo
clientUseTimelonggetClientUseTime()NoNo
itemInHandItemgetItemInHand()NoNo
targetBlockVector3igetTargetBlock()NoNo
targetEntityEntitygetTargetEntity()NoNo
screenPointVector2fgetScreenPoint()NoNo
mouseMotionMouseMotionEventgetMouseMotion()NoNo
  • playerRef — ECS reference to the player entity. Inherited from PlayerEvent.
  • player — The player who triggered the input. Inherited from PlayerEvent.
  • clientUseTime — Client-side timestamp of the use action.
  • itemInHand — The item the player is holding.
  • targetBlock — World-space coordinates of the targeted block, if any.
  • targetEntity — The targeted entity, if any.
  • screenPoint — Screen-space coordinates of the mouse cursor.
  • mouseMotion — The mouse motion event data (delta movement, drag state).
  • InteractionModule.doMouseInteraction() (line 428) via eventBus dispatchFor — EventBus dispatch when a player moves the mouse during an active drag interaction.
getEventRegistry().register(PlayerMouseMotionEvent.class, event -> {
Player player = event.getPlayer();
MouseMotionEvent motion = event.getMouseMotion();
Vector2f screenPoint = event.getScreenPoint();
// Example: track mouse drag positions
logDragPosition(player, screenPoint);
});