[PR #7577] The save round trip no longer depends on where the player lands #7686

Open
opened 2026-11-03 07:21:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7577
Author: @HrafnaValkyrja
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/spawner-delay-roundtrip


📝 Commits (2)

  • 022e7ba test: save round-trip scene no longer depends on where the player lands
  • e272f7a Merge remote-tracking branch 'origin/main' into fix/spawner-delay-roundtrip

📊 Changes

1 file changed (+11 additions, -3 deletions)

View changed files

📝 tools/save_roundtrip_scene.py (+11 -3)

📄 Description

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

The save round-trip test (tools/test_save_roundtrip_parity.py) failed on the mob spawner's Delay in 3 of 5 runs (vanilla 20, Horizon 10 or 11). It was the scene, not Horizon: this makes the spawner, vault and trial spawner independent of where each game puts its player. No Rust code changed.

Part of #6545

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

BaseSpawner.serverTick returns at once unless isNearPlayer (an alive player within RequiredPlayerRange, default 16), and only then counts spawnDelay down. A vault changes to active, and shows its item, when a player is within activation_range (default 4). So these block entities change with the position of the player, which each game picks at random near the world spawn.

Proof

  • Measured on vanilla 26.3: loading the saved world and joining the bot, the bot stood at (-9.5, -60, -1.5), 19.8 blocks from the spawner at (5, -60, 11), and Delay stayed 20 for the 25 s it was connected. In another run the bot stood about 11 blocks away and the spawner had counted down to 0.
  • Measured on Horizon with a temporary log in server_tick for that spawner: it ran 10 times with a player near, Delay 20 down to 11, and the save happened then. Same rule as vanilla; only the number of ticks before the save differs from run to run.
  • The same cause then showed in 1 of 10 runs as a vault going active (shared_data.connected_players, display_item).
  • The scene now gives the spawner RequiredPlayerRange:0s, the vault activation_range:1,deactivation_range:2 and the trial spawner required_player_range:1. Default values stay covered by the copies of each block with no NBT, placed away from spawn.
  • After the change: 10 consecutive save_roundtrip runs, all 0 unexplained differences. Before the vault change: 9 of 10 clean, and the one failure was the vault.

Harnesses

test_save_roundtrip_parity.py 10 runs in a row (0 unexplained differences each) and pr_ready.py --quick (pass; Python tests 614 passed).

A refactor with no behaviour change; proved by script, no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at 2050c4e0f, 32 s)

Check Result
Scope ✅ 1 files, +11 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (32 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 204 affected, to run in CI (--quick): anvil_turtle_egg, forced_end, free_space, generation_tick, geometry, ghost_recipe, ground_support, hardcore_respawn, height_provider, heightmap, held_drop, held_item_stack and 192 more
Label skip-release

🤖 Generated with Claude Code

https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 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/7577 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/spawner-delay-roundtrip` --- ### 📝 Commits (2) - [`022e7ba`](https://github.com/horizon-rust/horizon/commit/022e7ba3ba19d37843b919034bbf1567d88947d3) test: save round-trip scene no longer depends on where the player lands - [`e272f7a`](https://github.com/horizon-rust/horizon/commit/e272f7a585dc1ce805813385253ac0929afa4b04) Merge remote-tracking branch 'origin/main' into fix/spawner-delay-roundtrip ### 📊 Changes **1 file changed** (+11 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tools/save_roundtrip_scene.py` (+11 -3) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. The save round-trip test (`tools/test_save_roundtrip_parity.py`) failed on the mob spawner's `Delay` in 3 of 5 runs (vanilla 20, Horizon 10 or 11). It was the scene, not Horizon: this makes the spawner, vault and trial spawner independent of where each game puts its player. No Rust code changed. Part of #6545 ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `BaseSpawner.serverTick` returns at once unless `isNearPlayer` (an alive player within `RequiredPlayerRange`, default 16), and only then counts `spawnDelay` down. A vault changes to active, and shows its item, when a player is within `activation_range` (default 4). So these block entities change with the position of the player, which each game picks at random near the world spawn. ## Proof - Measured on vanilla 26.3: loading the saved world and joining the bot, the bot stood at (-9.5, -60, -1.5), 19.8 blocks from the spawner at (5, -60, 11), and `Delay` stayed 20 for the 25 s it was connected. In another run the bot stood about 11 blocks away and the spawner had counted down to 0. - Measured on Horizon with a temporary log in `server_tick` for that spawner: it ran 10 times with a player near, `Delay` 20 down to 11, and the save happened then. Same rule as vanilla; only the number of ticks before the save differs from run to run. - The same cause then showed in 1 of 10 runs as a vault going active (`shared_data.connected_players`, `display_item`). - The scene now gives the spawner `RequiredPlayerRange:0s`, the vault `activation_range:1,deactivation_range:2` and the trial spawner `required_player_range:1`. Default values stay covered by the copies of each block with no NBT, placed away from spawn. - After the change: 10 consecutive `save_roundtrip` runs, all 0 unexplained differences. Before the vault change: 9 of 10 clean, and the one failure was the vault. ## Harnesses `test_save_roundtrip_parity.py` 10 runs in a row (0 unexplained differences each) and `pr_ready.py --quick` (pass; Python tests 614 passed). A refactor with no behaviour change; proved by script, no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at 2050c4e0f, 32 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +11 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (32 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 204 affected, to run in CI (--quick): anvil_turtle_egg, forced_end, free_space, generation_tick, geometry, ghost_recipe, ground_support, hardcore_respawn, height_provider, heightmap, held_drop, held_item_stack and 192 more | | Label | `skip-release` | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7686
No description provided.