Appearance
Events
Event handlers are registered using feature:on(event_name, handler). All events that support cancellation share a common cancelled property.
Common Properties
| Property | Type | Description |
|---|---|---|
cancelled | boolean | Set to true to block the event from proceeding. |
Game Events
packet
Event details for network packets.
- Property
packet:object- The raw Java packet object. - Property
type:string- The type of packet ("client" or "server").
chat_message
Event details for outgoing chat messages.
- Property
message:string- The message content.
key_press
Event details for keyboard input.
- Property
key:enums.key_code- The key code. - Property
modifiers:number- The bitmask of active modifiers.
mouse_event
Event details for mouse input.
- Property
position:types.vector2- The scaled mouse position. - Property
button:number- The mouse button index. - Property
state:string- The mouse interaction state ("click", "released", "scroll"). - Property
scroll_x:number- The scroll delta on X axis. - Property
scroll_y:number- The scroll delta on Y axis.
player_block_collision
Called when the client checks for player block collisions.
- Property
voxel_shape:object- The voxel shape of the collision (Minecraft's Java VoxelShape object). - Property
position:object- The position of the block (Minecraft's Java BlockPos object). - Property
block_state:object- The state of the block (Minecraft's Java BlockState object).
player_attack_entity
Called when the player attacks an entity.
- Property
entity:object- The entity being attacked (Minecraft's Java Entity object). - Property
type:string- The attack type ("pre" or "post").
player_inventory_close
Called when a container is closed.
player_item_slow_down
Called when the player slows down when using items.
- Property
modifier:number- The slow down modifier.
player_jump
Called when the player jumps.
- Property
yaw:number- The jump yaw. - Property
delta_y:number- The jump delta Y.
player_move
Called when the player moves.
- Property
delta_x:number- The movement delta X. - Property
delta_y:number- The movement delta Y. - Property
delta_z:number- The movement delta Z.
player_push
Called when another entities pushes the player.
player_send_update
Called when the player sends an update packet.
- Property
x:number- The x position. - Property
y:number- The y position. - Property
z:number- The z position. - Property
yaw:number- The yaw rotation. - Property
pitch:number- The pitch rotation. - Property
on_ground:boolean- Whether the player is on the ground. - Property
type:string- The update type ("pre" or "post").
player_step
Called when the player wants to step up a block.
- Property
height:number- The step height.
player_tick
Called when the player ticks.
level_change
Called when the level changes.
- Property
level:object- The new level object.
toggle_feature
Called when a feature is toggled.
- Property
feature_name:string- The name of the feature being toggled. - Property
state:boolean- The new state of the feature.
game_loop
Called when the game loop ticks.
client_rotation
Called when updating the player rotation.
- Property
rotation:types.vector2- The current rotations (x: yaw, y: pitch). - Property
tick_delta:number- The tick delta. - Method
set_rotation(yaw, pitch): Sets the new rotation, rotations will automatically be corrected (GCD applied, properly clamped & wrapped).
window_resize
Called when the client window is resized.
- Property
width:number- The new window width. - Property
height:number- The new window height.
music_update
Called when the music data gets updated.
- Property
data:types.music_data- The music data object.
play_sound
Called when a sound plays.
- Property
sound:string- The sound id string.
Rendering Events
prepare_ui_canvas
Called when building the ui geometry.
- Property
canvas:types.ui_canvas- The ui canvas. - Property
scaled_size:types.vector2- The scaled window size. - Property
mouse_position:types.vector2- The mouse position. - Property
tick_delta:number- The tick delta.
prepare_world_canvas
Called when building the world geometry.
- Property
canvas:types.world_canvas- The world canvas. - Property
mouse_position:types.vector2- The mouse position. - Property
tick_delta:number- The tick delta.
Core Events
| Event | Handler Sig | Description |
|---|---|---|
enabled | function() | Called when the feature is enabled |
disabled | function() | Called when the feature is disabled |
game_tick | function() | Called every game tick |
on_interface_suffix | function(): string | Returns a suffix for the HUD enabled list |
