Hotkey Module¶
The Keyboard Module can listen to the same hotkey as the Hotkey module that players bound in their client.
When active, Keyboard Module will forward player's key events to Smart Glasses.
In addition, Keyboard Module may also capture player's mouse by invoking setCaptureMouse(true), and then fire corresponding events.
Events¶
keyboard_open¶
Fires when the player opened the keyboard.
Values: None
1 2 | |
keyboard_close¶
Fires when the player closed the keyboard.
Values: None
1 2 | |
player_interaction¶
Fires when a player pressed a mouse button while keyboard module is capturing mouse.
Interactions must be registered by setHandlingInteraction first.
Values:
interaction: numberPerforming interaction:1for attack;2for use;3for pick.block_state: table | nilAiming block, if exists.entity_uuid: string | nilAiming entity UUID, if exists.
1 2 | |
player_mouse_click¶
Fires when a player pressed a mouse button while keyboard module is capturing mouse.
Values:
button: numberThe mouse button which clicked down.
1 2 | |
player_mouse_up¶
Fires when the player released a mouse button while keyboard module is capturing mouse.
Values:
button: numberThe mouse button which released up.
1 2 | |
player_mouse_move¶
Fires when a player moved mouse while keyboard module is capturing mouse.
Values:
dx: numberHorizontal mouse movementdy: numberVertical mouse movement
1 2 | |
player_mouse_scroll¶
Fires when a player scrolled mouse while keyboard module is capturing mouse.
Values:
dy: numberVertical mouse scroll amountdx: numberHorizontal mouse scroll amount
1 2 | |
Functions¶
isCapturingKeys¶
isCapturingKeys() -> boolean
returns true if the keyboard is currently open, false otherwise.
isCapturingMouse¶
isCapturingMouse() -> boolean
returns true if the mouse is currently captured, false otherwise.
setCaptureMouse¶
setCaptureMouse(enable: boolean) -> nil
set if the mouse should be captured.
isHandlingInteraction¶
isHandlingInteraction(interaction: number) -> boolean
returns true if the interaction is currently being intercepted, false otherwise.
setHandlingInteraction¶
setHandlingInteraction(interaction: number, value: boolean) -> nil
set if the interaction should be intercepted.
Intercepted interaction will not perform its normal duty, player_interaction event will be fired instead.
| interaction | description |
|---|---|
| 1 | attack / dig block |
| 2 | use stuffs |
| 3 | pick block / entity |
Changelog/Trivia¶
0.8
Added Hotkey Module
