Events
Events are typed signals from the game. Subscribe with JsMacros.on, wait with JsMacros.waitForEvent, and read each event page for its payload and cancellation rules. High-frequency events such as Tick and packet events need tight filtering.
Core
Events raised by JsMacros itself rather than by the game.
- Custom — A named event with key-value arguments.
- ProfileLoad — Fires after a profile's script triggers have been registered, including at startup and on profile switches.
- Service — Event payload for a running service, including shared arguments and stop callbacks.
- WrappedScript — Payload for scripts run through wrapScriptRun() or wrapScriptRunAsync.
Inputs/Interactions
Keyboard, mouse, block, entity, and sign interactions.
- AttackBlock — Fires when the client's startDestroyBlock call returns true for a block target.
- AttackEntity — Fires after the local player's entity-attack action.
- InteractBlock — Fires after a local block-use attempt returns, unless the result is FAIL.
- InteractEntity — Fires after the local player's entity-interact action returns, except when it returns InteractionResult.FAIL.
- Key — Fires for keyboard and mouse-button input before the game's input handling.
- MouseScroll — Fires before the game handles a scroll input, only when no screen or overlay is open, a player is present, and at least one raw offset is nonzero.
- SignEdit — Fires when the local player opens a sign editing screen.
Inventory
Container contents, slot changes, pickups, and item damage.
- ClickSlot — Fires when the local player clicks a slot in an open container screen, which includes the player's own inventory and the creative inventory.
- ContainerUpdate — Fires after the client handles a full container-content packet.
- DropSlot — Fires for drops from a container screen (including clicking outside it) and for hotbar-key drops when no screen is open.
- HeldItemChange — Fires when polling detects a change to the local player's main- or off-hand stack, at most once per client tick.
- ItemDamage — Fires when polling detects a main-hand, off-hand, or armor stack change attributable to its damage value.
- ItemPickup — Fires while handling an item-pickup packet for the local player, before the corresponding client inventory update.
- OpenContainer — Fires after a container screen is set.
- SlotUpdate — Fires for a server update to one menu slot or the cursor stack.
Network/Chat
Chat, packets, server joins, disconnects, and player-list changes.
- Disconnect — Fires when the client disconnects, including when leaving without a disconnection screen.
- JoinServer — Fires after the login packet is handled and the local player exists; the world may still be loading.
- NameChange — Fires when an entity's custom-name data changes.
- PlayerJoin — Fired when a player-list entry is first added to the client player list.
- PlayerLeave — Fired when a matching player-list entry is removed from the client player list.
- RecvMessage — Fired before a message is added to the chat HUD.
- RecvPacket — Fires for an incoming packet before it is handled by the game.
- SendMessage — Fires for text submitted through the chat screen, before the game normalizes it.
- SendPacket — Fires synchronously at the client's packet-send path, including for non-gameplay packets.
Player/Stats
Health, hunger, air, armor, effects, death, and riding changes.
- AirChange — Fires before the local player's air supply is set to a value divisible by 20; it does not report other values.
- ArmorChange — Fires when client-tick polling detects a change to one of the local player's four armor slots.
- Damage — Fires when a call decreases the local player's health, before the incoming value is applied.
- Death — Fires while handling the server's player-combat-kill packet, before the client shows the death screen.
- EXPChange — Fires before the client writes the local player's experience values.
- FallFlying — Fires when the local player's polled fall-flying state differs from the previous sample.
- Heal — Fires before the local player's health is updated to a higher value.
- HealthChange — Fires before the local player's health is updated.
- HungerChange — Fires before the local player's food level is assigned, when setFoodLevel receives a value different from the current one.
- Riding — Fires from a startRiding return path when the local player attempts to mount, or when the player begins removing an existing vehicle.
- StatusEffectUpdate — Fires while the client processes a status-effect update or removal packet for the local player.
Render/UI
Titles, boss bars, opened screens, and editor code-render hooks.
- Bossbar — Reports each boss-bar packet action after the client handles it.
- CodeRender — Event passed to the editor's script-based code compiler.
- OpenScreen — Fires when the client's current screen changes, including when a screen is closed.
- Title — Fires when the client receives a title, subtitle, or action-bar message; type identifies the HUD line.
System/Lifecycle
Game launch and quit, resource packs, and command context.
- CommandContext — The parsed context for a client command, containing its arguments and command source.
- LaunchGame — Fires at the head of the client's run method and provides the client session's name.
- QuitGame — Fires during JVM shutdown from a shutdown hook registered by JsMacros.
- ResourcePackLoaded — Fires when a resource reload completes and the loading overlay begins fading out.
World
Blocks, chunks, dimensions, entities, sounds, and ticks.
- BlockUpdate — Fires after a block-state or block-entity update packet is handled.
- ChunkLoad — Fires after a full chunk-data packet has updated the client world.
- ChunkUnload — Fires after the client processes a server packet to forget a chunk.
- DimensionChange — Fires when the client begins setting a non-null world, such as when joining or changing dimensions.
- EntityDamaged — Fires before a client-side living entity's health decreases through setHealth; it does not identify a damage source.
- EntityHealed — Fires before a client-side living entity's setHealth call when the supplied health is greater than its previous value.
- EntityLoad — Fires after an entity is added to the client world.
- EntityUnload — Fires when an entity is removed from the client world.
- Sound — Fires when the sound engine receives a sound instance, before it attempts playback.
- Tick — Fires after the key-macro check, tick synchronizer, and server-list pinger on each client tick.