How events work
A mod registers listeners; the game builds the event's arguments, calls the listeners in ascending priority (LOWEST -2000, LOW -1000, NORMAL 0, HIGH 1000, HIGHEST 2000, ties in mod load order) and then MONITOR listeners, which only read. On a cancellable event the first Cancel skips the remaining listeners, except those registered with receive_cancelled, which may answer Uncancel.
| Kind | What a listener does |
|---|---|
Plain | Read the arguments; cancellable events also take Flow::Cancel / seer.CANCEL / 1. |
Modify | Arguments marked mut are written in place by listeners, in priority order. |
Override | Write out (the SDK and the script runtimes also set set = true). The last writer in priority order wins; the game uses out only when set. |
| Thread | Fires on |
|---|---|
Render | the render thread |
Tick | the client tick, also on the render thread |
Net | the connection thread (raw packets, raw plugin messages); native mods only |
Any | any thread, for example mesh workers; native mods only |
Filters. An event marked with a registry (EntityType, Item, Block, BlockEntityType, SoundEvent, ParticleType, DataComponentType, ScreenKind, PacketId, MenuType) carries that entry's raw id as its first argument, and a listener can subscribe to a set of ids only. Get an id with registry_id(registry, "minecraft:diamond"), where registry is the position in that list (Item = 1). Handles (ItemStack, Gui, Lines, ...) are valid only during the call that hands them out.
#[seer::event(ItemTooltip)] // event name = wrapper type
fn tooltip(e: &mut ItemTooltip) { .. } // e.stack(), e.advanced(), e.lines()
#[seer::event(ClientTick::End)] // Family::Phase = ClientTickEnd
fn tick(_e: &mut ClientTickEnd) { .. }
#[seer::event(ChatReceive::Allow, priority = HIGH, receive_cancelled = true)]
fn chat(e: &mut ChatReceive) -> Flow { Flow::Continue }seer.on("ItemTooltip", function(e) -- fields by their api.ron names
if seer.stack_item_id(e.stack) == DIAMOND then e.lines:push("Shiny") end
end, { priority = seer.PRIORITY.HIGH })
seer.on("FovModify", function(e) e.fov = e.fov * 0.9 end) -- a mut field
seer.on("ItemGlint", function(e) e.out = true end) -- an Override: out (+ set)Permissions
Declared in seer.mod.json "permissions". Lua and WASM mods are held to them; for native mods they are advisory. An unknown name refuses the mod.
| Bit | Manifest name | Needed by |
|---|---|---|
| 0 | chat.send | chat_send, command_send, ChatSendModify, CommandSendModify |
| 1 | network.http | PacketReceivedRaw, PacketSendRaw |
| 2 | fs.config | mod_data_read, mod_data_write, mod_data_delete, mod_data_list |
| 3 | screen.open | screen_open, screen_close |
| 4 | input.override | player_set_rot, ScreenKey, ScreenChar, ScreenMouse, ScreenScroll, KeyInput, MouseButton, MouseScroll, MouseMove, KeyStateOverride, KeyClickOverride, PlayerInput |
| 5 | render.offscreen | render_projection, render_modelview, texture_create, texture_upload, texture_release, buffer_create, buffer_write, buffer_release, pipeline_create, pipeline_set_uniform, draw_submit, offscreen_target_create, offscreen_target_bind, offscreen_target_release, post_pass_register, texture_location, offscreen_target_texture, offscreen_target_clear, pipeline_release |
| 6 | clipboard | reserved |