[GH-ISSUE #1474] [both singleplayer modes] Saving and reopening while riding a horse loses the riding state #443

Closed
opened 2026-11-02 15:39:07 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @rdbtCVS on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1474

Tested b65e082fd7f912ab787246ba6c3f0f7f464ec892 with explicit --no-server-thread and --server-thread.

Reproduce:

  1. Mount a tamed, saddled horse.
  2. Save and quit while still riding, then reopen the same world.

Expected: remain mounted, as native 26.3 does.
Actual in both modes: the horse survives, but the player loads on foot. A live save keeps the player mounted; reopening loses the relationship.

Evidence: paired current-riding-d/save-reopen-* worlds and nested reopens under .local/singleplayer-audit/, driver tools/singleplayer_riding_audit.py. Riding is non-null before/after the live save and null after reopening and settling. The same horse remains at (0.5,100,3.5).

Native control native-riding-reopen-reference positively executes as Player on vehicle both before and after reopening. Native player data contains RootVehicle; both Horizon saves omit it.

Hypothesis: the vehicle relationship is omitted from player save/load, rather than restored on login.

Acceptance: saving and reopening restores the player on the same horse in both modes, without duplicating the horse or its equipment.

Current main is blocked by the known build failure covered by PR #1472; this report identifies the exact buildable commit tested.

Originally created by @rdbtCVS on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1474 Tested `b65e082fd7f912ab787246ba6c3f0f7f464ec892` with explicit `--no-server-thread` and `--server-thread`. Reproduce: 1. Mount a tamed, saddled horse. 2. Save and quit while still riding, then reopen the same world. Expected: remain mounted, as native 26.3 does. Actual in both modes: the horse survives, but the player loads on foot. A live save keeps the player mounted; reopening loses the relationship. Evidence: paired `current-riding-d/save-reopen-*` worlds and nested reopens under `.local/singleplayer-audit/`, driver `tools/singleplayer_riding_audit.py`. Riding is non-null before/after the live save and null after reopening and settling. The same horse remains at `(0.5,100,3.5)`. Native control `native-riding-reopen-reference` positively executes `as Player on vehicle` both before and after reopening. Native player data contains `RootVehicle`; both Horizon saves omit it. Hypothesis: the vehicle relationship is omitted from player save/load, rather than restored on login. Acceptance: saving and reopening restores the player on the same horse in both modes, without duplicating the horse or its equipment. Current main is blocked by the known build failure covered by PR #1472; this report identifies the exact buildable commit tested.
Author
Owner

@levzzz5154 commented on GitHub (Oct 26, 2026):

🤖 Agent: fixed in https://github.com/ludovic111/horizon/pull/2577 (branch fix/root-vehicle-restore).

What I changed: the player's file now names the vehicle it rides, and the ride comes back on the next login.

  • The player compound holds a RootVehicle compound whose Attach is the UUID of the vehicle at the root of the rider chain (Entity.getRootVehicle) — the same key and the same UUID encoding vanilla's ServerPlayer.saveParentVehicle uses. Horizon keeps the vehicle in the world, so the file names it instead of holding a second copy of it: the horse and its equipment stay in the chunk's entity file and nothing is duplicated.
  • Single player's own player writes the vehicle it rides (Game::sync_level); a server's guests write theirs (playerdata::store / playerdata::save, for the integrated server's owner and for a dedicated server's players).
  • On the next login the vehicle is looked up by its UUID among the entities in the world (Game::restore_root_vehicle, Game::restore_guest_vehicles) and the player rides it again, as ServerPlayer.loadAndSpawnParentVehicle does. A vehicle that is gone leaves the player on foot.

Vanilla followed: net.minecraft.server.level.ServerPlayer.saveParentVehicle and ServerPlayer.loadAndSpawnParentVehicle (both read and write the RootVehicle tag, with Attach holding the ridden vehicle's UUID), net.minecraft.world.entity.Entity.getRootVehicle (the vehicle at the root of the rider chain) and net.minecraft.world.entity.EntityType.loadEntityRecursive (how vanilla loads the vehicle back).

What I verified:

  • cargo test -p horizon-client --lib -- a_saved → 3 passed; 0 failed, including the new a_saved_root_vehicle_comes_back (the file names the vehicle, and the next login reads it back).
  • cargo test -p horizon-client --lib → 1189 passed; 0 failed; cargo test -p horizon-client --bin horizon-client → 122 passed; 0 failed.
  • The game itself, driven through its control socket in single player's --in-frame mode: command summon minecraft:horse ~ ~ ~, command ride @s mount @e[type=horse,limit=1], "Save and Quit to Title", then open again → riding before the save: 40, riding after the reopen: 88, one horse in the world, and the player file holds RootVehicle: {'Attach': ('I', [-923244113, -1727575934, -2026702819, 330676147])}.
<!-- gh-comment-id:6429994147 --> @levzzz5154 commented on GitHub (Oct 26, 2026): 🤖 Agent: fixed in https://github.com/ludovic111/horizon/pull/2577 (branch `fix/root-vehicle-restore`). What I changed: the player's file now names the vehicle it rides, and the ride comes back on the next login. - The player compound holds a `RootVehicle` compound whose `Attach` is the UUID of the vehicle at the root of the rider chain (`Entity.getRootVehicle`) — the same key and the same UUID encoding vanilla's `ServerPlayer.saveParentVehicle` uses. Horizon keeps the vehicle in the world, so the file names it instead of holding a second copy of it: the horse and its equipment stay in the chunk's entity file and nothing is duplicated. - Single player's own player writes the vehicle it rides (`Game::sync_level`); a server's guests write theirs (`playerdata::store` / `playerdata::save`, for the integrated server's owner and for a dedicated server's players). - On the next login the vehicle is looked up by its UUID among the entities in the world (`Game::restore_root_vehicle`, `Game::restore_guest_vehicles`) and the player rides it again, as `ServerPlayer.loadAndSpawnParentVehicle` does. A vehicle that is gone leaves the player on foot. Vanilla followed: `net.minecraft.server.level.ServerPlayer.saveParentVehicle` and `ServerPlayer.loadAndSpawnParentVehicle` (both read and write the `RootVehicle` tag, with `Attach` holding the ridden vehicle's UUID), `net.minecraft.world.entity.Entity.getRootVehicle` (the vehicle at the root of the rider chain) and `net.minecraft.world.entity.EntityType.loadEntityRecursive` (how vanilla loads the vehicle back). What I verified: - `cargo test -p horizon-client --lib -- a_saved` → `3 passed; 0 failed`, including the new `a_saved_root_vehicle_comes_back` (the file names the vehicle, and the next login reads it back). - `cargo test -p horizon-client --lib` → `1189 passed; 0 failed`; `cargo test -p horizon-client --bin horizon-client` → `122 passed; 0 failed`. - The game itself, driven through its control socket in single player's `--in-frame` mode: `command summon minecraft:horse ~ ~ ~`, `command ride @s mount @e[type=horse,limit=1]`, "Save and Quit to Title", then `open` again → `riding before the save: 40`, `riding after the reopen: 88`, one horse in the world, and the player file holds `RootVehicle: {'Attach': ('I', [-923244113, -1727575934, -2026702819, 330676147])}`.
Author
Owner

@kacpherek commented on GitHub (Oct 29, 2026):

Cause, from the port ledger's verdict map (#3139, tracked in #3520): ServerPlayer.saveParentVehicle and loadAndSpawnParentVehicle have no port, so the mount is not saved with the player (RootVehicle) and the player is not put back on it when the world loads. See also #3248.

<!-- gh-comment-id:6488864479 --> @kacpherek commented on GitHub (Oct 29, 2026): Cause, from the port ledger's verdict map (#3139, tracked in #3520): `ServerPlayer.saveParentVehicle` and `loadAndSpawnParentVehicle` have no port, so the mount is not saved with the player (`RootVehicle`) and the player is not put back on it when the world loads. See also #3248.
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#443
No description provided.