PlayerMouseMotionEvent
PlayerMouseMotionEvent
Section titled “PlayerMouseMotionEvent”Package:
com.hypixel.hytale.server.core.event.events.playerExtends:PlayerEvent<Void>Implements:IEvent<Void>,ICancellableCancellable: 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.
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Notes |
|---|---|---|---|---|
playerRef | Ref<EntityStore> | getPlayerRef() | No | ECS reference to the player entity. Inherited from PlayerEvent. |
player | Player | getPlayer() | No | The player who triggered the input. Inherited from PlayerEvent. |
clientUseTime | long | getClientUseTime() | No | Client-side timestamp of the use action. |
itemInHand | Item | getItemInHand() | No | The item the player is holding. |
targetBlock | Vector3i | getTargetBlock() | No | World-space coordinates of the targeted block, if any. |
targetEntity | Entity | getTargetEntity() | No | The targeted entity, if any. |
screenPoint | Vector2f | getScreenPoint() | No | Screen-space coordinates of the mouse cursor. |
mouseMotion | MouseMotionEvent | getMouseMotion() | No | The mouse motion event data (delta movement, drag state). |
Fired By
Section titled “Fired By”InteractionModule.doMouseInteraction()(line 428) viaeventBus.dispatchFor()— dispatched when a player moves the mouse during an active drag interaction.
Listening
Section titled “Listening”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);});Related Events
Section titled “Related Events”PlayerMouseButtonEvent— the companion input event for mouse button presses/releases. Together these two events cover all mouse input.PlayerInteractEvent— deprecated predecessor that handled both button and motion input in a single event.