[PR #6923] [MERGED] Minecarts: enable experimental speed rules and rotate-with-minecart controls #7199

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6923
Author: @masa-masa-0314
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/minecart-experiment-parity


📝 Commits (7)

  • 555e5e3 Minecarts: connect experimental speed rules, track motion and rider rotation
  • 165ba4d Merge upstream main and retain feature-aware command packets
  • 2a36c81 Tests: include carts in the remote motion fixture
  • a315017 Merge upstream minecart water-state fixes and experimental redstone
  • 0bac0eb Merge upstream vehicle fluid updates without replacing experimental steps
  • aee91ca Merge main into #6923
  • 1776384 Minecart rotations: HotSpot atan2 in vanilla's operation order

📊 Changes

30 files changed (+840 additions, -158 deletions)

View changed files

📝 crates/horizon-client-core/src/gamerules.rs (+51 -12)
📝 crates/horizon-client-render/src/datapack.rs (+5 -1)
📝 crates/horizon-client-render/src/options_ui.rs (+12 -1)
📝 crates/horizon-client/src/game/chat.rs (+2 -1)
📝 crates/horizon-client/src/game/commands.rs (+2 -2)
📝 crates/horizon-client/src/game/commands/execute.rs (+1 -1)
📝 crates/horizon-client/src/game/dragon.rs (+1 -0)
📝 crates/horizon-client/src/game/lan.rs (+32 -5)
📝 crates/horizon-client/src/game/lan_actions.rs (+5 -3)
📝 crates/horizon-client/src/game/lan_chat.rs (+5 -3)
📝 crates/horizon-client/src/game/lan_entities.rs (+15 -2)
📝 crates/horizon-client/src/game/lan_screen.rs (+11 -1)
📝 crates/horizon-client/src/game/minecarts.rs (+313 -80)
📝 crates/horizon-client/src/game/options.rs (+2 -0)
📝 crates/horizon-client/src/game/perspective.rs (+18 -5)
📝 crates/horizon-client/src/game/remote.rs (+74 -14)
📝 crates/horizon-client/src/game/remote_objects.rs (+6 -1)
📝 crates/horizon-client/src/game/remote_vehicles.rs (+30 -0)
📝 crates/horizon-client/src/game/world_loading.rs (+7 -12)
📝 crates/horizon-client/src/game_rules_screen.rs (+7 -6)

...and 10 more files

📄 Description

🤖 Opened by masa-masa-0314's AI agent (ZCode, GPT-6), not by masa-masa-0314 personally.

What and why

Fixes #6896.

In experimental minecart worlds, /gamerule max_minecart_speed was missing and movement used a fixed speed. The accessibility option to rotate with a minecart was marked unavailable and had no rider-rotation implementation. This PR connects both player-facing controls and fixes the experimental movement and synchronization paths they depend on.

  • Register max_minecart_speed and its namespaced form only with minecraft:minecart_improvements: default 8, bounds 1–1000. Thread world features through local/server command parsing, help, completion, network command trees, rule screens, save/load, and Create/Re-Create World. Feature-aware command caches do not reuse an experimental tree for a normal world.
  • Use the rule for experimental rail and off-rail speed. Preserve first-iteration slope/input/braking changes before slowdown; remove the fixed 16-rail iteration cap; correct track transitions, projection, boost bookkeeping, slope tolerances and experimental water-drag precision.
  • Record actual position/velocity/yaw/pitch/weight substeps and send the existing experimental minecart packet. Preserve pitch and weighted partial-tick interpolation on the client. Configuration feature flags are retained per connection, rather than discarded or written into an unrelated local world. Pairing snapshots do not consume pending trajectory data.
  • Make rotateWithMinecart usable in an experimental world. Match vanilla's horizontal rider rotation with half-step smoothing; preserve manual looking and do not add pitch-following. The option is saved through the existing options mechanism and is disabled outside an eligible world.
  • Use the experimental trajectory for the current player's riding camera position and the new cart-render transform.

The rule, simulation, packet and camera changes are kept together so a higher configured speed does not continue to use a constant server cap or ordinary endpoint-only client movement. Shared water-state, size and entity-pushing work already underway in other contributions is not represented here as solved.

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
  • extra: Horizon-only, off by default
  • tooling
  • docs

Vanilla reference

Independently inspected 26.3 GameRules, GameRuleCommand, MinecraftServer, WorldCreationUiState, CreateWorldScreen, NewMinecartBehavior, AbstractMinecart, Minecart, MinecartTNT, MinecartFurnace, ServerEntity, configuration packet listeners, LocalPlayer, Camera, Options, AccessibilityOptionsScreen, EntityRenderer, and AbstractMinecartRenderer.

The speed rule is max_minecart_speed, not a camel-case legacy spelling. getMaxSpeed uses the rule times the water factor (0.5 or 1), divided by 20. Rider turning comes from Minecart.positionRider and LocalPlayer.shouldRotateWithMinecart, not a camera pitch lock.

Other projects' code

None.

Verification

Temporary probes and tests were used, archived outside the tracked tree, and removed from the final diff according to the contributor's requested workflow. Existing tests are retained, with required struct-literal updates.

  • Direct calls to the shipped vanilla jar versus extracted production Rust calculations: 10,665/10,665 numerical cases matched, including all ten rail shapes, slopes, braking/input, boost bookkeeping, obstruction, reattachment and high-speed multi-rail travel. Comparisons hold supplied water state and collision scenarios fixed; they are not full-world physics proof.
  • Rule tests cover ordinary/experimental world isolation, both accepted IDs, missing/incorrect IDs, default 8, bounds 0/1001 rejected, packet-to-client parser/completion, and the same experimental world's 8 → 200 → 1000 save/reload sequence. Create/Re-Create tests include custom feature providers and ordering.
  • Tracker tests cover zero-weight initial correction, multi-step packet encode/decode, three-tick accumulation, clearing after transmission, re-pairing and the ordinary movement path. Production CartLerp probes cover weighted corners, partial angles, zero weights and successive batches. A real in-memory protocol Pipe verifies configuration feature forwarding.
  • Rotate-with-minecart: 2,500 vanilla sequences matched for cart offsets and player yaw/pitch, plus 30,000 three-perspective/partial-frame camera comparisons within the recorded tolerances. A small number of reconstructed previous-yaw values differ by a few ULPs (maximum approximately 0.000006 degrees); full-camera bit identity is not claimed.
  • A temporary UI test exercised the actual button's eligibility, click/toggle, options save and reload.

Remaining differences and validation limits

This is not a claim that every minecart behavior is now equivalent to vanilla:

  • Upstream #6665 has now been merged into this branch: its cached water state, float-derived dimensions and drag are preserved alongside the experimental algorithm. All 10,665 numerical comparisons were rerun after resolving that merge and matched. Upstream #6491 was subsequently merged as well: fluid updates and bubble effects are retained, with experimental effects placed after substep recording. This merge was checked with the same 10,665 empty-effect numerical scenarios; real in-world water/bubble interaction is still not claimed as end-to-end verified.
  • Per-move entity pickup/pushing, pickup retry movement, and some shared seat attachments still differ; entity pushing is already being worked on separately.
  • Third-person rider models and other passengers still lack the full EntityRenderer.passengerOffset; spectator-following another passenger is not covered by the local-player camera adjustment.
  • The headless command harness stopped in its initial terrain-settle step before any script command executed. Nearby chunks were lit and public stage queues were empty but busy remained true. No end-to-end command/ride pass is claimed and the completion condition was not relaxed.
  • A GPU skinning test failed by one ULP and the same failure was reproduced on a clean 3a264943c baseline. It is not counted as passing.
  • Manually clearing all experimental flags from an already experimental Level can retain older NBT metadata in the existing writer. Normal gameplay does not offer that operation; this PR does not fix it.

Self-check

After the recorded run below, this branch also merged upstream ce8d86cb2 (including #6665, #6491 and #6906). Post-merge numerical comparisons passed; final compile checks are reported in the follow-up validation note.

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-3050AHP, against upstream/main at c1f308fe6, 10 min 13 s)

Check Result
Scope ⚠️ 29 files, +823 −156; 978 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 610 run, FAILED (failures=1, errors=1, skipped=1) (2 min 47 s)
rustfmt ✅ (17 s)
clippy ✅ (1 min 31 s)
tests: horizon-client, horizon-client-core, horizon-client-lib, horizon-client-render, horizon-command ❌ 3151 passed, 1 failed (4 min 50 s)
doc tests ✅ 0 passed (9 s)
content root tests ➖ content root untouched
mod API up to date ✅ (35 s)
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)

Follow-up to that unedited output: the existing Python test_remote_motion fixture needed a carts field after the shared velocity-handler change. The fixture was updated without removing its assertions and its individual test now passes (commit 2a36c8144). The remaining input-capture fixture failure was reproduced from clean upstream c1f308fe6 inputs (input_trace / note_input missing). The single Rust failure is the GPU skinning one-ULP difference documented above; it also reproduced on clean 3a264943c. These failures are not presented as passes. --quick did not rerun parity; the explicit comparisons above are separate runs.

Screenshots

No visible game window was launched. Numeric/oracle, UI state-machine and protocol tests are reported above; live rendered riding remains a manual acceptance step.

🤖 Generated with ZCode (GPT-6).


🔄 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/6923 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/minecart-experiment-parity` --- ### 📝 Commits (7) - [`555e5e3`](https://github.com/horizon-rust/horizon/commit/555e5e33ca9dc9bcf420da703fd51706a390e042) Minecarts: connect experimental speed rules, track motion and rider rotation - [`165ba4d`](https://github.com/horizon-rust/horizon/commit/165ba4d162a88e4d64fc9259cfbfbca930a9f0fa) Merge upstream main and retain feature-aware command packets - [`2a36c81`](https://github.com/horizon-rust/horizon/commit/2a36c8144bb6993683d159e5187e2fed7ea41910) Tests: include carts in the remote motion fixture - [`a315017`](https://github.com/horizon-rust/horizon/commit/a315017dd138e8524d5e0ee3b93f73b8624197ad) Merge upstream minecart water-state fixes and experimental redstone - [`0bac0eb`](https://github.com/horizon-rust/horizon/commit/0bac0eb87706123f0c02991dfa663510144a22c1) Merge upstream vehicle fluid updates without replacing experimental steps - [`aee91ca`](https://github.com/horizon-rust/horizon/commit/aee91ca707bc4c8aa08abac675ef571984a957c8) Merge main into #6923 - [`1776384`](https://github.com/horizon-rust/horizon/commit/1776384ac05f5d2ca6603737eddae8f255093013) Minecart rotations: HotSpot atan2 in vanilla's operation order ### 📊 Changes **30 files changed** (+840 additions, -158 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/gamerules.rs` (+51 -12) 📝 `crates/horizon-client-render/src/datapack.rs` (+5 -1) 📝 `crates/horizon-client-render/src/options_ui.rs` (+12 -1) 📝 `crates/horizon-client/src/game/chat.rs` (+2 -1) 📝 `crates/horizon-client/src/game/commands.rs` (+2 -2) 📝 `crates/horizon-client/src/game/commands/execute.rs` (+1 -1) 📝 `crates/horizon-client/src/game/dragon.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+32 -5) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+5 -3) 📝 `crates/horizon-client/src/game/lan_chat.rs` (+5 -3) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+15 -2) 📝 `crates/horizon-client/src/game/lan_screen.rs` (+11 -1) 📝 `crates/horizon-client/src/game/minecarts.rs` (+313 -80) 📝 `crates/horizon-client/src/game/options.rs` (+2 -0) 📝 `crates/horizon-client/src/game/perspective.rs` (+18 -5) 📝 `crates/horizon-client/src/game/remote.rs` (+74 -14) 📝 `crates/horizon-client/src/game/remote_objects.rs` (+6 -1) 📝 `crates/horizon-client/src/game/remote_vehicles.rs` (+30 -0) 📝 `crates/horizon-client/src/game/world_loading.rs` (+7 -12) 📝 `crates/horizon-client/src/game_rules_screen.rs` (+7 -6) _...and 10 more files_ </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode, GPT-6), not by masa-masa-0314 personally. ## What and why Fixes #6896. In experimental minecart worlds, `/gamerule max_minecart_speed` was missing and movement used a fixed speed. The accessibility option to rotate with a minecart was marked unavailable and had no rider-rotation implementation. This PR connects both player-facing controls and fixes the experimental movement and synchronization paths they depend on. - Register `max_minecart_speed` and its namespaced form only with `minecraft:minecart_improvements`: default 8, bounds 1–1000. Thread world features through local/server command parsing, help, completion, network command trees, rule screens, save/load, and Create/Re-Create World. Feature-aware command caches do not reuse an experimental tree for a normal world. - Use the rule for experimental rail and off-rail speed. Preserve first-iteration slope/input/braking changes before slowdown; remove the fixed 16-rail iteration cap; correct track transitions, projection, boost bookkeeping, slope tolerances and experimental water-drag precision. - Record actual position/velocity/yaw/pitch/weight substeps and send the existing experimental minecart packet. Preserve pitch and weighted partial-tick interpolation on the client. Configuration feature flags are retained per connection, rather than discarded or written into an unrelated local world. Pairing snapshots do not consume pending trajectory data. - Make `rotateWithMinecart` usable in an experimental world. Match vanilla's horizontal rider rotation with half-step smoothing; preserve manual looking and do not add pitch-following. The option is saved through the existing options mechanism and is disabled outside an eligible world. - Use the experimental trajectory for the current player's riding camera position and the new cart-render transform. The rule, simulation, packet and camera changes are kept together so a higher configured speed does not continue to use a constant server cap or ordinary endpoint-only client movement. Shared water-state, size and entity-pushing work already underway in other contributions is not represented here as solved. ## Kind - [x] 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 - [ ] extra: Horizon-only, off by default - [ ] tooling - [ ] docs ## Vanilla reference Independently inspected 26.3 `GameRules`, `GameRuleCommand`, `MinecraftServer`, `WorldCreationUiState`, `CreateWorldScreen`, `NewMinecartBehavior`, `AbstractMinecart`, `Minecart`, `MinecartTNT`, `MinecartFurnace`, `ServerEntity`, configuration packet listeners, `LocalPlayer`, `Camera`, `Options`, `AccessibilityOptionsScreen`, `EntityRenderer`, and `AbstractMinecartRenderer`. The speed rule is `max_minecart_speed`, not a camel-case legacy spelling. `getMaxSpeed` uses the rule times the water factor (0.5 or 1), divided by 20. Rider turning comes from `Minecart.positionRider` and `LocalPlayer.shouldRotateWithMinecart`, not a camera pitch lock. ## Other projects' code None. ## Verification Temporary probes and tests were used, archived outside the tracked tree, and removed from the final diff according to the contributor's requested workflow. Existing tests are retained, with required struct-literal updates. - Direct calls to the shipped vanilla jar versus extracted production Rust calculations: 10,665/10,665 numerical cases matched, including all ten rail shapes, slopes, braking/input, boost bookkeeping, obstruction, reattachment and high-speed multi-rail travel. Comparisons hold supplied water state and collision scenarios fixed; they are not full-world physics proof. - Rule tests cover ordinary/experimental world isolation, both accepted IDs, missing/incorrect IDs, default 8, bounds 0/1001 rejected, packet-to-client parser/completion, and the same experimental world's 8 → 200 → 1000 save/reload sequence. Create/Re-Create tests include custom feature providers and ordering. - Tracker tests cover zero-weight initial correction, multi-step packet encode/decode, three-tick accumulation, clearing after transmission, re-pairing and the ordinary movement path. Production CartLerp probes cover weighted corners, partial angles, zero weights and successive batches. A real in-memory protocol Pipe verifies configuration feature forwarding. - Rotate-with-minecart: 2,500 vanilla sequences matched for cart offsets and player yaw/pitch, plus 30,000 three-perspective/partial-frame camera comparisons within the recorded tolerances. A small number of reconstructed previous-yaw values differ by a few ULPs (maximum approximately 0.000006 degrees); full-camera bit identity is not claimed. - A temporary UI test exercised the actual button's eligibility, click/toggle, options save and reload. ## Remaining differences and validation limits This is not a claim that every minecart behavior is now equivalent to vanilla: - Upstream #6665 has now been merged into this branch: its cached water state, float-derived dimensions and drag are preserved alongside the experimental algorithm. All 10,665 numerical comparisons were rerun after resolving that merge and matched. Upstream #6491 was subsequently merged as well: fluid updates and bubble effects are retained, with experimental effects placed after substep recording. This merge was checked with the same 10,665 empty-effect numerical scenarios; real in-world water/bubble interaction is still not claimed as end-to-end verified. - Per-move entity pickup/pushing, pickup retry movement, and some shared seat attachments still differ; entity pushing is already being worked on separately. - Third-person rider models and other passengers still lack the full `EntityRenderer.passengerOffset`; spectator-following another passenger is not covered by the local-player camera adjustment. - The headless command harness stopped in its initial terrain-settle step before any script command executed. Nearby chunks were lit and public stage queues were empty but `busy` remained true. No end-to-end command/ride pass is claimed and the completion condition was not relaxed. - A GPU skinning test failed by one ULP and the same failure was reproduced on a clean `3a264943c` baseline. It is not counted as passing. - Manually clearing all experimental flags from an already experimental Level can retain older NBT metadata in the existing writer. Normal gameplay does not offer that operation; this PR does not fix it. ## Self-check After the recorded run below, this branch also merged upstream `ce8d86cb2` (including #6665, #6491 and #6906). Post-merge numerical comparisons passed; final compile checks are reported in the follow-up validation note. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-3050AHP, against upstream/main at c1f308fe6, 10 min 13 s) | Check | Result | | --- | --- | | Scope | ⚠️ 29 files, +823 −156; 978 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 610 run, FAILED (failures=1, errors=1, skipped=1) (2 min 47 s) | | rustfmt | ✅ (17 s) | | clippy | ✅ (1 min 31 s) | | tests: horizon-client, horizon-client-core, horizon-client-lib, horizon-client-render, horizon-command | ❌ 3151 passed, 1 failed (4 min 50 s) | | doc tests | ✅ 0 passed (9 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (35 s) | | 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) | Follow-up to that unedited output: the existing Python `test_remote_motion` fixture needed a `carts` field after the shared velocity-handler change. The fixture was updated without removing its assertions and its individual test now passes (commit `2a36c8144`). The remaining input-capture fixture failure was reproduced from clean upstream `c1f308fe6` inputs (`input_trace` / `note_input` missing). The single Rust failure is the GPU skinning one-ULP difference documented above; it also reproduced on clean `3a264943c`. These failures are not presented as passes. `--quick` did not rerun parity; the explicit comparisons above are separate runs. ## Screenshots No visible game window was launched. Numeric/oracle, UI state-machine and protocol tests are reported above; live rendered riding remains a manual acceptance step. 🤖 Generated with ZCode (GPT-6). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:35:35 +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#7199
No description provided.