Overview
Events are the primary way to react to game actions and client state changes in LiquidBounce. Scripts can listen to events to implement custom behavior.Event Handlers
Register event handlers usingmodule.on() within a module:
Cancellable Events
Some events can be cancelled to prevent default behavior:Available Events
Here’s a comprehensive list of events you can listen to:Player Events
playerTick
playerTick
Called every tick for the local player. Cancellable.Source:
PlayerTickEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:43)playerPostTick
playerPostTick
Called after player tick processing.Source:
PlayerPostTickEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:46)playerMove
playerMove
Called when the player moves.Source:
PlayerMoveEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:64)playerJump
playerJump
Called when the player jumps. Cancellable.Source:
PlayerJumpEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:67)playerAfterJump
playerAfterJump
Called immediately after a jump is executed.Source:
PlayerAfterJumpEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:70)playerSafeWalk
playerSafeWalk
Control whether the player should avoid falling off edges.Source:
PlayerSafeWalkEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:98)playerStep
playerStep
Modify step height for climbing blocks.Source:
PlayerStepEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:101)healthUpdate
healthUpdate
Called when player health, food, or saturation changes.Source:
HealthUpdateEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:37)death
death
Called when the player dies.Source:
DeathEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/PlayerEvents.kt:40)Game Events
gameTick
gameTick
Called every game tick (20 times per second).Source:
GameTickEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:41)key
key
Called when a key is pressed.Source:
KeyEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:55)movementInput
movementInput
Modify player movement input.Source:
MovementInputEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:65)sprint
sprint
Control sprint state.Source:
SprintEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:72)mouseRotation
mouseRotation
Modify mouse rotation. Cancellable.Source:
MouseRotationEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:85)Network Events
packet
packet
Called for incoming and outgoing packets. Cancellable.Source:
PacketEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/NetworkEvents.kt:34)Chat Events
chatReceive
chatReceive
Called when receiving a chat message. Cancellable.Source:
ChatReceiveEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:132)chatSend
chatSend
Called when sending a chat message. Cancellable.Source:
ChatSendEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:127)Connection Events
serverConnect
serverConnect
Called when connecting to a server. Cancellable.Source:
ServerConnectEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:146)disconnect
disconnect
Called when disconnecting from a server.Source:
DisconnectEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:154)session
session
Called when session changes (login).Source:
SessionEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:117)Screen Events
screen
screen
Called when screen/GUI changes. Cancellable.Source:
ScreenEvent (~/workspace/source/src/main/kotlin/net/ccbluex/liquidbounce/event/events/GameEvents.kt:122)Event Properties
Each event object contains specific properties. Access them via the event parameter:Cancelling Events
For cancellable events, useevent.cancelEvent():
Best Practices
Check for null
Check for null
Always verify that game objects exist:
Use specific events
Use specific events
Choose the most specific event for your needs:
- Use
playerTickfor frequent player updates - Use
gameTickfor less frequent game logic - Use specific events like
playerJumpinstead of checking inplayerTick
Performance considerations
Performance considerations
Avoid heavy operations in frequently-called events:
Handle errors gracefully
Handle errors gracefully
Wrap potentially failing code in try-catch:
Event Categories Summary
Player Events
- playerTick, playerPostTick
- playerMove, playerJump
- playerSafeWalk, playerStep
- healthUpdate, death
Game Events
- gameTick, key
- movementInput, sprint
- mouseRotation
Network Events
- packet
- serverConnect, disconnect
- session
Chat & UI Events
- chatReceive, chatSend
- screen
Next Steps
API Reference
Explore available utilities and functions
Creating Modules
Build modules that use events