[PR #6991] [MERGED] Minecarts and boats cross Nether portals with mob riders, and carts keep their speed #7254

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

📋 Pull Request Information

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

Base: main ← Head: fix/cart-portal


📝 Commits (8)

  • c484234 Minecarts and boats cross Nether portals with mob riders and land like vanilla
  • 3c6aa58 Merge remote-tracking branch 'origin/main' into fix/cart-portal
  • 9963ac5 Merge remote-tracking branch 'origin/main' into fix/cart-portal
  • dcb5ee8 Regenerate the mod API output after the merge with main
  • 2f675aa Merge origin/main into fix/cart-portal
  • bc3c5a9 Merge origin/main into fix/cart-portal
  • a2d7b32 Merge origin/main into fix/cart-portal
  • e38e711 Merge origin/main into fix/cart-portal

📊 Changes

6 files changed (+416 additions, -37 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -0)
📝 crates/horizon-client/src/game/entity.rs (+11 -0)
📝 crates/horizon-client/src/game/levels.rs (+17 -0)
📝 crates/horizon-client/src/game/nether_portal.rs (+130 -36)
📝 crates/horizon-client/src/game/persist.rs (+1 -1)
➕ tools/cart_portal_e2e.py (+252 -0)

📄 Description

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

What and why

Fixes two minecart portal bugs. A minecart or boat with a mob on it never went through a Nether portal. An empty minecart went through but landed off-centre, a tick late, lost its speed, and ended up far from where vanilla's cart does.

Changed: game/nether_portal.rs (+ levels.rs, game.rs, one pub(super) in persist.rs), new tools/cart_portal_e2e.py.

  • A boat or minecart with mob riders now crosses with them: the riders are saved under the vehicle's Passengers, removed from the level, and mounted again on arrival, moved by what the vehicle moved.
  • A boat or minecart lands in the middle of the exit portal's depth, like a mob.
  • A minecart's motion through a portal is clamped to 0.4 along x and z.
  • A vehicle handles its portal before it moves (from where it ended the last tick), and an arrival joins its level before that level's entities tick; an arrival in a level that already ticked this server tick joins at the end of that tick.

The window's own player riding a cart (#6021) is not part of this: it goes through the player's own trip, not through vehicle_can_use_portal, so a cart with only the player on it still stays. A server's players riding a vehicle already crossed with it and are unchanged.

Fixes #6990

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

  • Entity.handlePortal / teleportToPortalDestination / teleport / teleportCrossDimension: the passengers are ejected, each is teleported with calculatePassengerTransition (the vehicle's destination plus its own offset), the vehicle is recreated with restoreFrom, then the passengers startRiding it again.
  • AbstractMinecart.tick: computeSpeed(); handlePortal(); behavior.tick(), so the portal is handled at the start of the cart's tick.
  • AbstractMinecart.getRelativePortalPosition and AbstractBoat.getRelativePortalPosition: LivingEntity.resetForwardDirectionOfRelativePortalPosition.
  • PositionMoveRotation.of(Entity) takes getKnownMovement(); OldMinecartBehavior.getKnownMovement clamps x and z to [-0.4, 0.4].
  • ServerLevel ticks the levels in order, and addDuringTeleport adds the entity at once: into a later level it ticks that server tick, into an earlier one it stands until the next.

Proof

Side-by-side against the vanilla 26.3 server, both dedicated, ticks frozen and stepped one at a time. A minecart pushed at 0.4 along 10 rails into a portal, powered rails behind the exit portal. Cart x / speed per tick, both directions (Overworld to Nether; Nether to Overworld):

scene tick vanilla before after
empty, to Nether 22 1.900 / 0.379 1.300 / 1.051 1.900 / 0.380
30 5.059 / 0.658 3.038 / 0.358 5.060 / 0.658
40 9.059 / 0.940 6.996 / 0.741 9.060 / 0.940
empty, to Overworld 22 84.5 / 0.4 absent 84.5 / 0.4
23 84.9 / 0.379 84.3 / 1.051 84.9 / 0.380
40 91.659 / 0.917 89.596 / 0.709 91.660 / 0.917
with pig, to Nether 22 1.9 (pig 1.9) stuck at 10.132 1.9 (pig 1.9)
40 8.867 10.932 8.867
with pig, to Overworld 22 84.5 stuck 84.5 (pig 84.5, 3.5)
40 91.467 stuck 91.467

The cart arrives at y=100.0225 on tick 22 and falls onto the rail on tick 23 as in vanilla. 952 of 957 values over the five scenes (flat and powered rails, with and without a pig, with and without rails behind the exit portal, both directions) were compared at 1e-6 and match, the five that do not:

  • an unpowered cart at rest differs by 0.0004 to 0.0006 blocks (for example 1.7266 vs 1.7260 at tick 60), four values over three scenes: generic minecart damping near zero speed, not the portal; not changed here;
  • the pig's y on the single tick it arrives in the Overworld before the cart has moved (100.25, vanilla 100.0).

tools/cart_portal_e2e.py --bin-dir target/fast replays four of those scenes on Horizon alone and checks the vanilla numbers above (cart x, y, z, speed, pig x, z and y where it applies): all lanes match; with the fix reverted it reports 39 mismatches, starting with the pig lane's cart still at x=10.132.

Harnesses

Run with DISPLAY=:0 HORIZON_E2E_HEADLESS=1:

  • python3 tools/parity.py nether_portal boat_authority boat_paddle_reset boat_submerged mount_submerged vehicle_container player_travel dedicated_server server_entities: 9 passed, 0 failed.
  • python3 tools/lan_e2e.py --server-thread --check portal_rider (a server player on a horse through a portal, which shares the changed vehicle path): PASS.
  • python3 tools/cart_portal_e2e.py --bin-dir target/fast: all four lanes match vanilla; 39 mismatches with the fix reverted.
  • python3 tools/pr_ready.py --quick passes (658 client tests).

Proved by script against the real 26.3 server; no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at 3819db72c, 10 min 14 s)

Check Result
Scope ✅ 6 files, +432 −63
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 611 passed (40 s)
rustfmt ✅ (8 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (1 min 58 s)
tests: horizon-client, horizon-client-lib ✅ 2056 passed (6 min 59 s)
doc tests ✅ 0 passed (5 s)
content root tests ➖ content root untouched
mod API up to date ✅ (20 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 234 affected, to run in CI (--quick): armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, block_particles, block_removal, boat_authority, boat_paddle_reset, boat_submerged, breaking_model, command_exec, composter and 222 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/6991 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/cart-portal` --- ### 📝 Commits (8) - [`c484234`](https://github.com/horizon-rust/horizon/commit/c4842342cd2d5fa06169da1b22d3317af33c5938) Minecarts and boats cross Nether portals with mob riders and land like vanilla - [`3c6aa58`](https://github.com/horizon-rust/horizon/commit/3c6aa581bea5c22b4a1be68157322335bf6feb8d) Merge remote-tracking branch 'origin/main' into fix/cart-portal - [`9963ac5`](https://github.com/horizon-rust/horizon/commit/9963ac509755d9120e3fb2b9bc504a7211f3874a) Merge remote-tracking branch 'origin/main' into fix/cart-portal - [`dcb5ee8`](https://github.com/horizon-rust/horizon/commit/dcb5ee854208dd78dc012243fb6ac938c8bd41f7) Regenerate the mod API output after the merge with main - [`2f675aa`](https://github.com/horizon-rust/horizon/commit/2f675aaea759565e0ed45cf16ab4dda324896453) Merge origin/main into fix/cart-portal - [`bc3c5a9`](https://github.com/horizon-rust/horizon/commit/bc3c5a9e8091ac79d1091a5955fd262890381a66) Merge origin/main into fix/cart-portal - [`a2d7b32`](https://github.com/horizon-rust/horizon/commit/a2d7b32c2ad0bda5ba6e06d328e2bc62ac6bfa2b) Merge origin/main into fix/cart-portal - [`e38e711`](https://github.com/horizon-rust/horizon/commit/e38e711286874b1c8d84159361f92bef7987e28e) Merge origin/main into fix/cart-portal ### 📊 Changes **6 files changed** (+416 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -0) 📝 `crates/horizon-client/src/game/entity.rs` (+11 -0) 📝 `crates/horizon-client/src/game/levels.rs` (+17 -0) 📝 `crates/horizon-client/src/game/nether_portal.rs` (+130 -36) 📝 `crates/horizon-client/src/game/persist.rs` (+1 -1) ➕ `tools/cart_portal_e2e.py` (+252 -0) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Fixes two minecart portal bugs. A minecart or boat with a mob on it never went through a Nether portal. An empty minecart went through but landed off-centre, a tick late, lost its speed, and ended up far from where vanilla's cart does. Changed: `game/nether_portal.rs` (+ `levels.rs`, `game.rs`, one `pub(super)` in `persist.rs`), new `tools/cart_portal_e2e.py`. - A boat or minecart with mob riders now crosses with them: the riders are saved under the vehicle's `Passengers`, removed from the level, and mounted again on arrival, moved by what the vehicle moved. - A boat or minecart lands in the middle of the exit portal's depth, like a mob. - A minecart's motion through a portal is clamped to 0.4 along x and z. - A vehicle handles its portal before it moves (from where it ended the last tick), and an arrival joins its level before that level's entities tick; an arrival in a level that already ticked this server tick joins at the end of that tick. The window's own player riding a cart (#6021) is not part of this: it goes through the player's own trip, not through `vehicle_can_use_portal`, so a cart with only the player on it still stays. A server's players riding a vehicle already crossed with it and are unchanged. Fixes #6990 ## 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 (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference - `Entity.handlePortal` / `teleportToPortalDestination` / `teleport` / `teleportCrossDimension`: the passengers are ejected, each is teleported with `calculatePassengerTransition` (the vehicle's destination plus its own offset), the vehicle is recreated with `restoreFrom`, then the passengers `startRiding` it again. - `AbstractMinecart.tick`: `computeSpeed(); handlePortal(); behavior.tick()`, so the portal is handled at the start of the cart's tick. - `AbstractMinecart.getRelativePortalPosition` and `AbstractBoat.getRelativePortalPosition`: `LivingEntity.resetForwardDirectionOfRelativePortalPosition`. - `PositionMoveRotation.of(Entity)` takes `getKnownMovement()`; `OldMinecartBehavior.getKnownMovement` clamps x and z to [-0.4, 0.4]. - `ServerLevel` ticks the levels in order, and `addDuringTeleport` adds the entity at once: into a later level it ticks that server tick, into an earlier one it stands until the next. ## Proof Side-by-side against the vanilla 26.3 server, both dedicated, ticks frozen and stepped one at a time. A minecart pushed at 0.4 along 10 rails into a portal, powered rails behind the exit portal. Cart x / speed per tick, both directions (Overworld to Nether; Nether to Overworld): | scene | tick | vanilla | before | after | |---|---|---|---|---| | empty, to Nether | 22 | 1.900 / 0.379 | 1.300 / 1.051 | 1.900 / 0.380 | | | 30 | 5.059 / 0.658 | 3.038 / 0.358 | 5.060 / 0.658 | | | 40 | 9.059 / 0.940 | 6.996 / 0.741 | 9.060 / 0.940 | | empty, to Overworld | 22 | 84.5 / 0.4 | absent | 84.5 / 0.4 | | | 23 | 84.9 / 0.379 | 84.3 / 1.051 | 84.9 / 0.380 | | | 40 | 91.659 / 0.917 | 89.596 / 0.709 | 91.660 / 0.917 | | with pig, to Nether | 22 | 1.9 (pig 1.9) | stuck at 10.132 | 1.9 (pig 1.9) | | | 40 | 8.867 | 10.932 | 8.867 | | with pig, to Overworld | 22 | 84.5 | stuck | 84.5 (pig 84.5, 3.5) | | | 40 | 91.467 | stuck | 91.467 | The cart arrives at y=100.0225 on tick 22 and falls onto the rail on tick 23 as in vanilla. 952 of 957 values over the five scenes (flat and powered rails, with and without a pig, with and without rails behind the exit portal, both directions) were compared at 1e-6 and match, the five that do not: - an unpowered cart at rest differs by 0.0004 to 0.0006 blocks (for example 1.7266 vs 1.7260 at tick 60), four values over three scenes: generic minecart damping near zero speed, not the portal; not changed here; - the pig's y on the single tick it arrives in the Overworld before the cart has moved (100.25, vanilla 100.0). `tools/cart_portal_e2e.py --bin-dir target/fast` replays four of those scenes on Horizon alone and checks the vanilla numbers above (cart x, y, z, speed, pig x, z and y where it applies): all lanes match; with the fix reverted it reports 39 mismatches, starting with the pig lane's cart still at x=10.132. ## Harnesses Run with `DISPLAY=:0 HORIZON_E2E_HEADLESS=1`: - `python3 tools/parity.py nether_portal boat_authority boat_paddle_reset boat_submerged mount_submerged vehicle_container player_travel dedicated_server server_entities`: 9 passed, 0 failed. - `python3 tools/lan_e2e.py --server-thread --check portal_rider` (a server player on a horse through a portal, which shares the changed vehicle path): PASS. - `python3 tools/cart_portal_e2e.py --bin-dir target/fast`: all four lanes match vanilla; 39 mismatches with the fix reverted. - `python3 tools/pr_ready.py --quick` passes (658 client tests). Proved by script against the real 26.3 server; no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at 3819db72c, 10 min 14 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +432 −63 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 611 passed (40 s) | | rustfmt | ✅ (8 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (1 min 58 s) | | tests: horizon-client, horizon-client-lib | ✅ 2056 passed (6 min 59 s) | | doc tests | ✅ 0 passed (5 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (20 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 234 affected, to run in CI (--quick): armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, block_particles, block_removal, boat_authority, boat_paddle_reset, boat_submerged, breaking_model, command_exec, composter and 222 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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>
bsakaguchi 2026-11-03 06:36:30 +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#7254
No description provided.