[PR #4746] [MERGED] Native mods: per-level tick hooks (API 23) #5824

Closed
opened 2026-11-03 05:15:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4746
Author: @arismoko
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @levzzz5154

Base: main ← Head: native-level-tick


📝 Commits (1)

  • a5ff7b1 Native mods: add per-level tick hooks

📊 Changes

4 files changed (+34 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/levels.rs (+8 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+12 -1)
📝 docs/native-mods.md (+4 -0)
📝 native-hooks.json (+10 -0)

📄 Description

🤖 Opened by Aria's agent swarm, Dyna, not by Aria.

Fixes #4614.

Add native_level_tick_pre and native_level_tick_post, non-cancellable server-side observations for each dimension pass. The hook argument is the existing dimension ID. This corresponds to NeoForge LevelTickEvent.Pre and LevelTickEvent.Post. Public event documentation: https://docs.neoforged.net/docs/concepts/events/ . Vanilla 26.3 invokes ServerLevel.tick from MinecraftServer.tickChildren; the hook calls bracket Horizon's per-dimension pass.

The first Horizon pass also includes server-wide autosave, command extras and native_tick, which vanilla runs outside ServerLevel.tick. A pass waiting for terrain still emits both hooks. Paused or held passes emit neither, and an error skips post.

API 23 follows main at 22; it moves again only if #4665 merges first.

Reuses LevelDimension::id, the tick_server pass loop and the existing empty native hook and catalog patterns. The change adds no helper or extra lifecycle state.

Exact head: a5ff7b1b31. A throwaway native mixin logged 1,080 correctly paired events in the real integrated server with the host in the Overworld and guest in the Nether. The dedicated-server run recorded 198 paired events across the same two dimensions. Existing hook catalog and hookability tests passed. No new unit test drives Game::tick_server; its construction has no lightweight test fixture. Paused, held and error passes are covered by the code path only (running is None, or the loop breaks), not by a test.

Clippy failed on the known main-branch manual_range_contains lint in horizon-world/src/worldgen/aquifer/noise_based.rs:466 (also recorded in #4516 and #4574).

pr_ready (tools/pr_ready.py --base HEAD^ on LT-24-005, against HEAD^ at 9054950e0, 1 min 58 s)

Check Result
Scope ✅ 4 files, +34 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (28 s)
rustfmt ✅ (6 s)
clippy ❌ failed (13 s)
tests: horizon-client ✅ 1205 passed (1 min 9 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 (no vanilla data here): 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)

🔄 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/4746 **Author:** [@arismoko](https://github.com/arismoko) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `native-level-tick` --- ### 📝 Commits (1) - [`a5ff7b1`](https://github.com/horizon-rust/horizon/commit/a5ff7b1b316b87d5eb3ef95a738d9bfc79add133) Native mods: add per-level tick hooks ### 📊 Changes **4 files changed** (+34 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/levels.rs` (+8 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+12 -1) 📝 `docs/native-mods.md` (+4 -0) 📝 `native-hooks.json` (+10 -0) </details> ### 📄 Description > 🤖 Opened by Aria's agent swarm, Dyna, not by Aria. Fixes #4614. Add `native_level_tick_pre` and `native_level_tick_post`, non-cancellable server-side observations for each dimension pass. The hook argument is the existing dimension ID. This corresponds to NeoForge `LevelTickEvent.Pre` and `LevelTickEvent.Post`. Public event documentation: https://docs.neoforged.net/docs/concepts/events/ . Vanilla 26.3 invokes `ServerLevel.tick` from `MinecraftServer.tickChildren`; the hook calls bracket Horizon's per-dimension pass. The first Horizon pass also includes server-wide autosave, command extras and `native_tick`, which vanilla runs outside `ServerLevel.tick`. A pass waiting for terrain still emits both hooks. Paused or held passes emit neither, and an error skips post. API 23 follows main at 22; it moves again only if #4665 merges first. Reuses `LevelDimension::id`, the `tick_server` pass loop and the existing empty native hook and catalog patterns. The change adds no helper or extra lifecycle state. Exact head: a5ff7b1b316b87d5eb3ef95a738d9bfc79add133. A throwaway native mixin logged 1,080 correctly paired events in the real integrated server with the host in the Overworld and guest in the Nether. The dedicated-server run recorded 198 paired events across the same two dimensions. Existing hook catalog and hookability tests passed. No new unit test drives `Game::tick_server`; its construction has no lightweight test fixture. Paused, held and error passes are covered by the code path only (running is None, or the loop breaks), not by a test. Clippy failed on the known main-branch `manual_range_contains` lint in `horizon-world/src/worldgen/aquifer/noise_based.rs:466` (also recorded in #4516 and #4574). **pr_ready** (`tools/pr_ready.py --base HEAD^` on LT-24-005, against HEAD^ at 9054950e0, 1 min 58 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +34 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (28 s) | | rustfmt | ✅ (6 s) | | clippy | ❌ failed (13 s) | | tests: horizon-client | ✅ 1205 passed (1 min 9 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 (no vanilla data here): 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) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:15:14 +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#5824
No description provided.