[PR #7598] A ridden minecart keeps its speed through a Nether portal #7705

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

📋 Pull Request Information

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

Base: main ← Head: fix/cart-portal-player


📝 Commits (2)

  • 72e778a A minecart a player rides keeps its motion through a Nether portal (#6021)
  • 9812ee0 Merge remote-tracking branch 'origin/main' into fix/cart-portal-player

📊 Changes

7 files changed (+536 additions, -21 deletions)

View changed files

📝 crates/horizon-client/src/game/lan.rs (+3 -0)
📝 crates/horizon-client/src/game/nether_portal.rs (+45 -5)
📝 crates/horizon-client/src/game/server_travel.rs (+51 -14)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/RideTranscript.java (+115 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaProtocolClient.java (+20 -2)
➕ tools/cart_portal_player_e2e.py (+233 -0)
📝 tools/lan_e2e.py (+69 -0)

📄 Description

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

What and why

Fixes #6021 for a minecart a player rides into a Nether portal. On current main the cart and its rider did cross (single player, LAN guest and dedicated server run the same code), so "nothing happens" was already fixed. What was still wrong is what the rider's cart does on the other side: it arrived at rest, so a cart that went in at rail speed (a minecart chunk loader) stood still in the Nether instead of rolling on as in vanilla.

Changed: game/nether_portal.rs, game/server_travel.rs, game/lan.rs, new tools/cart_portal_player_e2e.py (with a ride mode in the Java protocol client), new check cart_portal_rider in tools/lan_e2e.py.

  • A minecart a server player rides keeps the motion it had when its portal was handled (clamped to 0.4 along x and z) when it arrives, instead of zero.
  • Its exit is planned from where it stood when its portal was handled, not from where its rider's tick moved it on to.
  • A ridden vehicle's portal is looked for after the riders' ticks have moved it (it moves with its rider, after the other entities were swept), so it is found the tick it enters the portal and not a tick late, from the next block of track.

Boats and mobs ridden by a player keep arriving at rest, as before: not measured here (a boat needs a water channel to reach a portal under way).

Fixes #6021

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 / teleportCrossDimension: the passengers are taken off, the vehicle is recreated at its own destination with PositionMoveRotation.of(this) (its getKnownMovement), and the passengers startRiding it again.
  • AbstractMinecart.tick opens with handlePortal(), so a cart goes through from where it stood at the end of the previous tick.
  • OldMinecartBehavior.getKnownMovement clamps x and z to [-0.4, 0.4].
  • AbstractMinecart.getRelativePortalPosition: the exit is the cart's own position relative to the portal (the player is placed under it).

Proof

Vanilla 26.3 and Horizon, both dedicated, flat world, a real-protocol client (the parity suite's vanilla-codec client, now with a ride mode) joins, right-clicks a minecart at rest on unpowered rails with a stone block behind it, a redstone block powers the rails, the minecart runs 8 blocks into a Nether portal with powered rails behind the exit portal. What the client is sent after the level change:

vanilla Horizon before Horizon after
level change respawn into the Nether respawn into the Nether respawn into the Nether
cart on arrival 1.5, 100.0625, 0.5 motion 0.4 1.5, 100.0, 0.5 motion 0.0 1.9, 100.0225, 0.5 motion 0.38 (one tick later, as the empty cart of the earlier fix at tick 22)
rider passengers of the cart: the player the player the player
next ticks motion 0.439, 0.614, 0.788 no more motion 0.380, 0.556 and on, rolling along the powered rail

Run: python3 tools/cart_portal_player_e2e.py --bin-dir target/fast prints this and fails when the cart arrives at rest; the unfixed binary arrives at rest and fails. A unit test (a_minecart_a_player_rides_keeps_its_clamped_motion_through_a_portal) fails with the fix reverted (0.0 against 0.4, -0.1, -0.4).

With a real Horizon client (tools/lan_e2e.py --check cart_portal_rider): the single-player window and a LAN guest each ride a minecart into a portal, both arrive in the Nether still on the same cart, with the cart under them and out of the Overworld. The check passed before and after the change: it guards the part that was already right.

Not matched: the tick the cart is first sent to the client differs by one tick from vanilla's (Horizon holds a rider on the loading screen until the exit chunks are lit, vanilla does not), so the client's first sight of the cart is the state a tick after arrival.

Harnesses

Run with DISPLAY=:0 HORIZON_E2E_HEADLESS=1:

  • python3 tools/cart_portal_player_e2e.py --bin-dir target/fast: the client sees what vanilla sends.
  • python3 tools/lan_e2e.py --check cart_portal_rider --check portal_rider: both PASS.
  • 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/pr_ready.py --quick: python tests, rustfmt, clippy and cargo test -p horizon-client (696) pass.

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 2050c4e0f, 4 min 2 s)

Check Result
Scope ✅ 7 files, +536 −21
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (28 s)
rustfmt ✅ (7 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 35 s)
tests: horizon-client ✅ 699 passed (1 min 35 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
mod API up to date ✅ (13 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 227 affected, to run in CI (--quick): anvil_turtle_egg, armor_stand_turtle_egg, arrow, arrow_wind_charge, block_removal, boat_authority, boat_paddle_reset, boat_submerged, command_exec, composter, crafter, cursor_death and 215 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/7598 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/cart-portal-player` --- ### 📝 Commits (2) - [`72e778a`](https://github.com/horizon-rust/horizon/commit/72e778a5eb838aacfd77101df4ad0e766790720f) A minecart a player rides keeps its motion through a Nether portal (#6021) - [`9812ee0`](https://github.com/horizon-rust/horizon/commit/9812ee0930352c4fce3f273f887a7bc669316dad) Merge remote-tracking branch 'origin/main' into fix/cart-portal-player ### 📊 Changes **7 files changed** (+536 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan.rs` (+3 -0) 📝 `crates/horizon-client/src/game/nether_portal.rs` (+45 -5) 📝 `crates/horizon-client/src/game/server_travel.rs` (+51 -14) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/RideTranscript.java` (+115 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaProtocolClient.java` (+20 -2) ➕ `tools/cart_portal_player_e2e.py` (+233 -0) 📝 `tools/lan_e2e.py` (+69 -0) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Fixes #6021 for a minecart a player rides into a Nether portal. On current main the cart and its rider did cross (single player, LAN guest and dedicated server run the same code), so "nothing happens" was already fixed. What was still wrong is what the rider's cart does on the other side: it arrived at rest, so a cart that went in at rail speed (a minecart chunk loader) stood still in the Nether instead of rolling on as in vanilla. Changed: `game/nether_portal.rs`, `game/server_travel.rs`, `game/lan.rs`, new `tools/cart_portal_player_e2e.py` (with a ride mode in the Java protocol client), new check `cart_portal_rider` in `tools/lan_e2e.py`. - A minecart a server player rides keeps the motion it had when its portal was handled (clamped to 0.4 along x and z) when it arrives, instead of zero. - Its exit is planned from where it stood when its portal was handled, not from where its rider's tick moved it on to. - A ridden vehicle's portal is looked for after the riders' ticks have moved it (it moves with its rider, after the other entities were swept), so it is found the tick it enters the portal and not a tick late, from the next block of track. Boats and mobs ridden by a player keep arriving at rest, as before: not measured here (a boat needs a water channel to reach a portal under way). Fixes #6021 ## 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` / `teleportCrossDimension`: the passengers are taken off, the vehicle is recreated at its own destination with `PositionMoveRotation.of(this)` (its `getKnownMovement`), and the passengers `startRiding` it again. - `AbstractMinecart.tick` opens with `handlePortal()`, so a cart goes through from where it stood at the end of the previous tick. - `OldMinecartBehavior.getKnownMovement` clamps x and z to [-0.4, 0.4]. - `AbstractMinecart.getRelativePortalPosition`: the exit is the cart's own position relative to the portal (the player is placed under it). ## Proof Vanilla 26.3 and Horizon, both dedicated, flat world, a real-protocol client (the parity suite's vanilla-codec client, now with a ride mode) joins, right-clicks a minecart at rest on unpowered rails with a stone block behind it, a redstone block powers the rails, the minecart runs 8 blocks into a Nether portal with powered rails behind the exit portal. What the client is sent after the level change: | | vanilla | Horizon before | Horizon after | |---|---|---|---| | level change | respawn into the Nether | respawn into the Nether | respawn into the Nether | | cart on arrival | 1.5, 100.0625, 0.5 motion 0.4 | 1.5, 100.0, 0.5 motion 0.0 | 1.9, 100.0225, 0.5 motion 0.38 (one tick later, as the empty cart of the earlier fix at tick 22) | | rider | passengers of the cart: the player | the player | the player | | next ticks | motion 0.439, 0.614, 0.788 | no more motion | 0.380, 0.556 and on, rolling along the powered rail | Run: `python3 tools/cart_portal_player_e2e.py --bin-dir target/fast` prints this and fails when the cart arrives at rest; the unfixed binary arrives at rest and fails. A unit test (`a_minecart_a_player_rides_keeps_its_clamped_motion_through_a_portal`) fails with the fix reverted (0.0 against 0.4, -0.1, -0.4). With a real Horizon client (`tools/lan_e2e.py --check cart_portal_rider`): the single-player window and a LAN guest each ride a minecart into a portal, both arrive in the Nether still on the same cart, with the cart under them and out of the Overworld. The check passed before and after the change: it guards the part that was already right. Not matched: the tick the cart is first sent to the client differs by one tick from vanilla's (Horizon holds a rider on the loading screen until the exit chunks are lit, vanilla does not), so the client's first sight of the cart is the state a tick after arrival. ## Harnesses Run with `DISPLAY=:0 HORIZON_E2E_HEADLESS=1`: - `python3 tools/cart_portal_player_e2e.py --bin-dir target/fast`: the client sees what vanilla sends. - `python3 tools/lan_e2e.py --check cart_portal_rider --check portal_rider`: both PASS. - `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/pr_ready.py --quick`: python tests, rustfmt, clippy and `cargo test -p horizon-client` (696) pass. 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 2050c4e0f, 4 min 2 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +536 −21 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (28 s) | | rustfmt | ✅ (7 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 35 s) | | tests: horizon-client | ✅ 699 passed (1 min 35 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (13 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 227 affected, to run in CI (--quick): anvil_turtle_egg, armor_stand_turtle_egg, arrow, arrow_wind_charge, block_removal, boat_authority, boat_paddle_reset, boat_submerged, command_exec, composter, crafter, cursor_death and 215 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>
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#7705
No description provided.