[PR #4412] [MERGED] Native mods: server tick Start before any level; one tick-clock step per server tick #5613

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

📋 Pull Request Information

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

Base: main ← Head: native/server-tick-at-start


📝 Commits (1)

  • 94a93ab Native mods: server tick Start fires before any level; the tick clock ticks once per server tick

📊 Changes

4 files changed (+29 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -4)
📝 crates/horizon-client/src/game/levels.rs (+19 -3)
📝 crates/horizon-client/src/game/native_hooks.rs (+5 -2)
📝 docs/native-mods.md (+1 -1)

📄 Description

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

Follow-up to #3878 (review note) and #4402.

  • Hook: ServerTickStart (native_server_tick, API 4) now fires at the top of tick_server, before any level is streamed or ticked, where NeoForge fires ServerTickEvent.Pre. It used to fire inside the first level's tick(), after that level's streaming and world update. The hook doc no longer calls it read-only (it gets &mut Game) and says to read blocks by dimension with native_server_block.
  • Tick clock (a parity fix): the tick rate manager (clock.world_runs()) now ticks once per server tick, before the levels, like MinecraftServer.tickServer → tickRateManager.tick(). Each level reuses the answer, as ServerLevel.tick only reads runsNormally(). Before, every extra dimension called world_runs() again: with /tick freeze + /tick step 1 and players in two dimensions, the step went to the first level and the second stayed frozen, and sprints were checked once per level.
  • In-frame play and a held server (hold_server) behave as before; a paused pass ticks nothing.

Checks

  • cargo clippy -p horizon-client --bins -D warnings: clean; cargo test -p horizon-client --bins native_: 16 passed
  • Parity, run locally until stopped (it was using the whole machine): 19 of the 38 affected harnesses passed, none failed: command_exec, block_removal, composter, crafter, cursor_death, dispenser, chest_pair, container_title, friends_integration, forced_end, mace, hardcore_respawn, dedicated_server, online_mode, remote_fireball, sculk, pearl_death, remote_fireworks, locator_bar. CI runs the rest.

🤖 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/4412 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `native/server-tick-at-start` --- ### 📝 Commits (1) - [`94a93ab`](https://github.com/horizon-rust/horizon/commit/94a93ab7aaa3e13d99bcc81b6246da13bab30475) Native mods: server tick Start fires before any level; the tick clock ticks once per server tick ### 📊 Changes **4 files changed** (+29 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -4) 📝 `crates/horizon-client/src/game/levels.rs` (+19 -3) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+5 -2) 📝 `docs/native-mods.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves. Follow-up to #3878 (review note) and #4402. - **Hook:** `ServerTickStart` (`native_server_tick`, API 4) now fires at the top of `tick_server`, before any level is streamed or ticked, where NeoForge fires `ServerTickEvent.Pre`. It used to fire inside the first level's `tick()`, after that level's streaming and world update. The hook doc no longer calls it read-only (it gets `&mut Game`) and says to read blocks by dimension with `native_server_block`. - **Tick clock (a parity fix):** the tick rate manager (`clock.world_runs()`) now ticks once per server tick, before the levels, like `MinecraftServer.tickServer` → `tickRateManager.tick()`. Each level reuses the answer, as `ServerLevel.tick` only reads `runsNormally()`. Before, every extra dimension called `world_runs()` again: with `/tick freeze` + `/tick step 1` and players in two dimensions, the step went to the first level and the second stayed frozen, and sprints were checked once per level. - In-frame play and a held server (`hold_server`) behave as before; a paused pass ticks nothing. ## Checks - `cargo clippy -p horizon-client --bins -D warnings`: clean; `cargo test -p horizon-client --bins native_`: 16 passed - Parity, run locally until stopped (it was using the whole machine): 19 of the 38 affected harnesses passed, none failed: command_exec, block_removal, composter, crafter, cursor_death, dispenser, chest_pair, container_title, friends_integration, forced_end, mace, hardcore_respawn, dedicated_server, online_mode, remote_fireball, sculk, pearl_death, remote_fireworks, locator_bar. CI runs the rest. 🤖 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 05:13:47 +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#5613
No description provided.