Skip to content

Events ​

Event handlers are registered using feature.on(event_name, handler). All events that support cancellation share a common cancelled property.

The Lua API definitions provide an overload for each event name, so the callback's event parameter is inferred automatically:

lua
feature.on("player_jump", function(event)
    event.yaw = 90
    event.cancelled = true
end)

Cancellable event types inherit from types.cancellable_event, which declares cancelled. Core callbacks such as enabled, disabled, and game_tick receive no event parameter.

Common Properties ​

PropertyTypeDescription
cancelledbooleanSet to true to block the event from proceeding.

Setting cancelled to false does not undo cancellation.

Game Events ​

packet ​

Event details for network packets.

  • Property packet: net.minecraft.network.protocol.Packet - The raw Java packet object.
  • Property type: string - The type of packet ("client" or "server").

The network functions network.send, network.send_no_event, network.is_server_packet, and network.process_packet accept Java packet instances, including packets created with java.new and the event.packet value received by this callback.

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: userdata - The voxel shape of the collision (Minecraft's Java VoxelShape object).
  • Property position: userdata - The position of the block (Minecraft's Java BlockPos object).
  • Property block_state: userdata - The state of the block (Minecraft's Java BlockState object).

player_attack_entity ​

Called when the player attacks an entity.

  • Property entity: userdata - The entity being attacked (Minecraft's Java Entity object).
  • Property type: string - The attack type ("pre" or "post").

player_attack_re_sprint ​

Called during attack slowdown and again before the attack resets sprinting.

  • Property velocity: types.vector3 - The velocity multipliers during slowdown, or the current player velocity during sprint reset. Assign a new vector to change the slowdown multipliers, editing the returned copy does not update the event. Velocity changes during sprint reset are not applied.
  • Property cancelled: boolean - Set to true to prevent the sprint reset. Cancellation does not prevent slowdown, change velocity to control it.
lua
feature.on("player_attack_re_sprint", function(event)
    event.velocity = types.vector3.new(1, 1, 1)
    event.cancelled = true
end)

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.

post_player_tick ​

Called after the player ticks.

level_change ​

Called when the level changes.

  • Property level: userdata - 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.

anti_bot ​

Called to check whether an entity is a bot or not.

  • Property entity: userdata - The entity to be checked (Minecraft's Java Entity object).
  • Property is_bot: boolean - Whether the entity is a bot or not.

server_chat_message ​

Called when the server sends a chat message.

  • Property message: string - The chat message.

detect_staff ​

Called when a staff is detected by the 'Staff Detector' feature.

  • Property username: string - The username of the detected staff, can be nil.

sprint_key_press ​

Called when the sprint key press state is checked.

  • Property pressed: boolean - Whether the sprint key is pressed.

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 ​

EventHandler SigDescription
enabledfunction()Called when the feature is enabled
disabledfunction()Called when the feature is disabled
game_tickfunction()Called every game tick
on_interface_suffixfunction(): stringReturns a suffix for the HUD enabled list