[GH-ISSUE #5138] Native mods: hook points for the server starting and stopping #1567

Closed
opened 2026-11-02 15:48:04 +07:00 by bsakaguchi · 0 comments
Owner

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

🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 personally.

Part of #4953 ("ServerStartingEvent: before worlds open"; "Level and server: … ServerStoppingEvent").

Native mods can see a world once it has opened (native_world_lifecycle's WorldOpenReady) and once it has been saved (WorldCloseFinal), but not the two points around them that NeoForge mods use most:

  • Before anything loads, NeoForge's ServerAboutToStartEvent ("Called before the server begins loading anything", javadoc): to reset a mod's per-server state, or read its config.
  • When an orderly stop begins, NeoForge's ServerStoppingEvent ("Called when the server begins an orderly shutdown, before ServerStoppedEvent", javadoc): with the worlds still loaded and the players still connected, to save a mod's own data or tell the players.

Proposal: two server-side hook points, native_server_about_to_start(dedicated) at the start of vanilla's MinecraftServer.loadLevel, and native_server_stopping(dedicated) at the start of MinecraftServer.stopServer. Both on the single player server thread and on a dedicated server; neither cancels. API next.

Originally created by @levzzz5154 on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5138 > 🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 personally. Part of #4953 ("`ServerStartingEvent`: before worlds open"; "Level and server: … `ServerStoppingEvent`"). Native mods can see a world once it has opened (`native_world_lifecycle`'s `WorldOpenReady`) and once it has been saved (`WorldCloseFinal`), but not the two points around them that NeoForge mods use most: - **Before anything loads**, NeoForge's `ServerAboutToStartEvent` ("Called before the server begins loading anything", [javadoc](https://mcstreetguy.github.io/NeoForgeJavaDocs/1.20.3-20.3.8/net/neoforged/neoforge/event/server/ServerAboutToStartEvent.html)): to reset a mod's per-server state, or read its config. - **When an orderly stop begins**, NeoForge's `ServerStoppingEvent` ("Called when the server begins an orderly shutdown, before ServerStoppedEvent", [javadoc](https://mcstreetguy.github.io/NeoForgeJavaDocs/1.20.3-20.3.8/net/neoforged/neoforge/event/server/ServerStoppingEvent.html)): with the worlds still loaded and the players still connected, to save a mod's own data or tell the players. Proposal: two server-side hook points, `native_server_about_to_start(dedicated)` at the start of vanilla's `MinecraftServer.loadLevel`, and `native_server_stopping(dedicated)` at the start of `MinecraftServer.stopServer`. Both on the single player server thread and on a dedicated server; neither cancels. API next.
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#1567
No description provided.