[GH-ISSUE #5128] Native mods: hook points for chunks and players coming and going #1562

Closed
opened 2026-11-02 15:48:00 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Qwerner88880 on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5128

Originally assigned to: @Qwerner88880 on GitHub.

🤖 Filed by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally.

Part of #3911 (Mods) and #4953 (Capabilities).

A native mod is told when a block changes, when a player ticks, when the server ticks — but not when the world itself changes shape: a chunk coming in, a chunk going out, a player joining, a player leaving. So a minimap can't mark what it has seen, a per-chunk cache (pipes, claims, machines) can't evict, and a welcome message or a join log has no event to ride.

What I plan, as four server-side hook points in the catalog:

  • native_chunk_load(dimension, chunk, new): after a chunk becomes part of the level, with whether it was just generated or loaded from the save.
  • native_chunk_unload(dimension, chunk): when a chunk leaves the level — streamed out, or a level closing because it ran empty. Each load/unload comes exactly once, in order.
  • native_player_logged_in(player, name): when a player joins the server (single player, LAN, dedicated).
  • native_player_logged_out(player, name): when a player leaves it, however they leave: a disconnect, a kick, the server stopping or failing. At a stop the hook runs before the save with the players still listed, so a last mod message still goes out.

None of them can cancel; they observe. NATIVE_HOOKS_API takes the next free number.

Originally created by @Qwerner88880 on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5128 Originally assigned to: @Qwerner88880 on GitHub. > 🤖 Filed by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. Part of #3911 (Mods) and #4953 (Capabilities). A native mod is told when a block changes, when a player ticks, when the server ticks — but not when the world itself changes shape: a chunk coming in, a chunk going out, a player joining, a player leaving. So a minimap can't mark what it has seen, a per-chunk cache (pipes, claims, machines) can't evict, and a welcome message or a join log has no event to ride. What I plan, as four server-side hook points in the catalog: - **`native_chunk_load(dimension, chunk, new)`:** after a chunk becomes part of the level, with whether it was just generated or loaded from the save. - **`native_chunk_unload(dimension, chunk)`:** when a chunk leaves the level — streamed out, or a level closing because it ran empty. Each load/unload comes exactly once, in order. - **`native_player_logged_in(player, name)`:** when a player joins the server (single player, LAN, dedicated). - **`native_player_logged_out(player, name)`:** when a player leaves it, however they leave: a disconnect, a kick, the server stopping or failing. At a stop the hook runs before the save with the players still listed, so a last mod message still goes out. None of them can cancel; they observe. `NATIVE_HOOKS_API` takes the next free number.
Author
Owner

@Qwerner88880 commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6543550594 --> @Qwerner88880 commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1562
No description provided.