Skip to content

PlayerMouseMotionEvent

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

Dispatched when a player moves the mouse during a drag interaction. This event 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.

Because the key type is Void, this event is dispatched globally — all registered listeners receive it regardless of key.

FieldTypeAccessorMutableNotes
playerRefRef<EntityStore>getPlayerRef()NoECS reference to the player entity. Inherited from PlayerEvent.
playerPlayergetPlayer()NoThe player who triggered the input. Inherited from PlayerEvent.
clientUseTimelonggetClientUseTime()NoClient-side timestamp of the use action.
itemInHandItemgetItemInHand()NoThe item the player is holding.
targetBlockVector3igetTargetBlock()NoWorld-space coordinates of the targeted block, if any.
targetEntityEntitygetTargetEntity()NoThe targeted entity, if any.
screenPointVector2fgetScreenPoint()NoScreen-space coordinates of the mouse cursor.
mouseMotionMouseMotionEventgetMouseMotion()NoThe mouse motion event data (delta movement, drag state).
  • InteractionModule.doMouseInteraction() (line 428) via eventBus.dispatchFor() — dispatched 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);
});
  • PlayerMouseButtonEvent — the companion input event for mouse button presses/releases. Together these two events cover all mouse input.
  • PlayerInteractEventdeprecated predecessor that handled both button and motion input in a single event.