[PR #5902] [MERGED] Native mods: hear that the server loaded or reloaded its data (API next) #6550

Closed
opened 2026-11-03 06:22:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5902
Author: @Sylviromi
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: data-reloaded


📝 Commits (2)

  • e6b365b Native mods: hear that the server loaded or reloaded its data
  • 693e8b0 Merge main into data-reloaded (beside native_data_pack_files)

📊 Changes

3 files changed (+24 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+13 -0)
➕ tools/native-hook-fragments/server_data_loaded.json (+7 -0)

📄 Description

🤖 Opened by Sylviromi's AI agent (Claude Code, Sonnet 5.5), not by Sylviromi personally.

What and why

Fixes #5582.

native_server_data_loaded(reload) is a new server-side hook point (NeoForge's TagsUpdatedEvent with UpdateCause.SERVER_DATA_LOAD). It fires once the server's data tables (recipes, tags, loot, advancements) are built, so a mod can drop caches derived from the data and rebind what depends on it instead of polling.

  • On a world's first open (reload false) it fires right after build_world_tables and the loot data are ready, before chunks and players load.
  • After every /reload (reload true) it fires at the end of reload_world_tables, after the players were sent the new data and the advancement tree reloaded.
  • A client connected to a server never fires it.

3 files, +24: game.rs (the two calls), native_hooks.rs (the hook point and its docs) and the fragment tools/native-hook-fragments/server_data_loaded.json. The API number is given at merge, so native-hooks.json and NATIVE_HOOKS_API are untouched (docs say "API next" through the fragment placeholder).

#5623 (native_data_pack_files, the sibling hook from #5581) adds its hook point beside this one in native_hooks.rs, so whichever merges second needs a trivial merge of main.

Proof: an offscreen in-game run with a test mod hooking it logged reload=false once at world open, then reload=true once per /reload (two reloads gave false true true), so the window's client does not double-fire it. The hook catalog tests pass (20/20) and tools/stamp_native_hooks.py --check is fine.

Label: feature (I cannot set labels; a maintainer please add it).

Kind

  • parity
  • bug
  • feature: something new for players (listed under New in the release notes)
  • extra
  • tooling
  • docs

Vanilla reference

Horizon-only API surface; the moment follows NeoForge's TagsUpdatedEvent (UpdateCause.SERVER_DATA_LOAD) after vanilla's ReloadableServerResources load. Not a gameplay change, so no parity harness.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on boilingpoint, against origin/main at 9543d2a68, 5 min 35 s)

Check Result
Scope ✅ 3 files, +24 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 515 passed (40 s)
rustfmt ✅ (11 s)
clippy ✅ (2 min 24 s)
tests: horizon-client ✅ 1678 passed (2 min 17 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Screenshots

Nothing visible.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5902 **Author:** [@Sylviromi](https://github.com/Sylviromi) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `data-reloaded` --- ### 📝 Commits (2) - [`e6b365b`](https://github.com/horizon-rust/horizon/commit/e6b365b01a787b4a7084dc89611d8f9b47d60670) Native mods: hear that the server loaded or reloaded its data - [`693e8b0`](https://github.com/horizon-rust/horizon/commit/693e8b0892ec1c2bc717368adb04c830a30a1877) Merge main into data-reloaded (beside native_data_pack_files) ### 📊 Changes **3 files changed** (+24 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+13 -0) ➕ `tools/native-hook-fragments/server_data_loaded.json` (+7 -0) </details> ### 📄 Description > 🤖 Opened by Sylviromi's AI agent (Claude Code, Sonnet 5.5), not by Sylviromi personally. ## What and why Fixes #5582. `native_server_data_loaded(reload)` is a new server-side hook point (NeoForge's `TagsUpdatedEvent` with `UpdateCause.SERVER_DATA_LOAD`). It fires once the server's data tables (recipes, tags, loot, advancements) are built, so a mod can drop caches derived from the data and rebind what depends on it instead of polling. - On a world's first open (`reload` false) it fires right after `build_world_tables` and the loot data are ready, before chunks and players load. - After every `/reload` (`reload` true) it fires at the end of `reload_world_tables`, after the players were sent the new data and the advancement tree reloaded. - A client connected to a server never fires it. 3 files, +24: `game.rs` (the two calls), `native_hooks.rs` (the hook point and its docs) and the fragment `tools/native-hook-fragments/server_data_loaded.json`. The API number is given at merge, so `native-hooks.json` and `NATIVE_HOOKS_API` are untouched (docs say "API next" through the fragment placeholder). #5623 (`native_data_pack_files`, the sibling hook from #5581) adds its hook point beside this one in `native_hooks.rs`, so whichever merges second needs a trivial merge of main. Proof: an offscreen in-game run with a test mod hooking it logged `reload=false` once at world open, then `reload=true` once per `/reload` (two reloads gave `false true true`), so the window's client does not double-fire it. The hook catalog tests pass (20/20) and `tools/stamp_native_hooks.py --check` is fine. Label: feature (I cannot set labels; a maintainer please add it). ## Kind - [ ] parity - [ ] bug - [x] feature: something new for players (listed under New in the release notes) - [ ] extra - [ ] tooling - [ ] docs ## Vanilla reference Horizon-only API surface; the moment follows NeoForge's `TagsUpdatedEvent` (`UpdateCause.SERVER_DATA_LOAD`) after vanilla's `ReloadableServerResources` load. Not a gameplay change, so no parity harness. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on boilingpoint, against origin/main at 9543d2a68, 5 min 35 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +24 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 515 passed (40 s) | | rustfmt | ✅ (11 s) | | clippy | ✅ (2 min 24 s) | | tests: horizon-client | ✅ 1678 passed (2 min 17 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## Screenshots Nothing visible. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:22:48 +07:00
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#6550
No description provided.