[PR #7133] [MERGED] Minecarts stop at the world border #7362

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

📋 Pull Request Information

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

Base: main ← Head: fix/7067-minecart-world-border-2


📝 Commits (3)

  • 3720600 Minecarts stop at the world border
  • baa5187 Test a minecart-sized body against the world border
  • a5cdf9f Merge origin/main into fix/7067-minecart-world-border

📊 Changes

2 files changed (+22 additions, -2 deletions)

View changed files

📝 crates/horizon-client-render/src/collisions.rs (+19 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+3 -2)

📄 Description

🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review.

Fixes #7067

What was wrong

Entity.move reaches CollisionGetter.getCollisions for every entity, and getBlockCollisions adds borderCollision(entity, box), so the world border stops a minecart as it does the player and, since #7077, a boat (read with javap on the 26.3 server jar, as in #7065). Game::move_cart (game/minecarts.rs) built its EntityCollisions with border: None, so a cart, and the player riding it, rolled straight through the border. Every cart move goes through move_cart (the old rail logic, the new minecart_improvements logic and come_off_track), so one line covers them all.

What changed

game/minecarts.rs: move_cart passes self.border.geometry() and the cart's x and z to EntityCollisions, as tick_boat, the player and the pistons do. One line of code and its comment.

horizon-client-render/src/collisions.rs: one test, a_minecart_sized_body_stops_at_the_border_wall.

Not touched, left to their own changes: dropped items (entities.rs also builds EntityCollisions with border: None), and the other members of the family (#7070, #7078, #7080). A LAN guest or a remote server's carts are interpolated from the host's packets (remote_minecart_lerp in remote_vehicles.rs), not moved by move_cart, so this fix on the host's side serves them; I did not run a LAN session.

How it was checked

In the game (horizon-ctl launch --offscreen, creative world, fresh game home), a flat strip of rail[shape=east_west] from x = -6 to 14, worldborder center 0 0 then worldborder set 10 (centre 0.5, so the walls are at x = -4.5 and 5.5), and summon minecart 0.5 100.0625 0.5 {Motion:[0.4d,0.0d,0.0d]}. The cart's x is read from horizon-ctl status (carts) and with /data get entity once it has stopped:

Build Cart x when it stops
origin/main (the same code with border: None) 10.49 (through the border, along the rails)
this branch 5.51 (stopped at the border)

5.51 is the right value, not 5.5: vanilla's WorldBorder.getCollisionShape rounds the walls outwards (floor(minX), ceil(maxX), border.rs:88), so the wall a cart meets is at x = 6.0, and the cart (0.98 wide, so 0.49 each side) stops with its centre at 5.51.

The test: a body the size of a minecart (0.98 × 0.7), 0.11 blocks short of the wall of a border 10 wide, moved 0.4 east (a cart's top speed) must move only 0.11. The expected value is worked out by hand from the cart's box and the wall, not read from the code. It covers EntityCollisions with a cart-sized box; it cannot catch the border: None itself, as move_cart needs a Game, which has no test fixture. The in-game run above is the check for that wiring.

Self-check

tools/pr_ready.py --quick --base origin/main before merging the latest origin/main (then cargo fmt --check, clippy -D warnings on horizon-client and horizon-client-render, and the new and entity_skin tests re-run after the merge):

Check Result
Scope 2 files, +22 −2
Cargo.lock unchanged
Public tree ✅
rustfmt, clippy ✅
tests: horizon-client, horizon-client-render 1806 passed, 1 failed before the merge: gfx::entity_skin::tests::the_shader_writes_what_the_cpu_reference_computes (one float differs in the last digit on my GPU, a file this PR does not touch); it passes after merging the entity_skin change now on main
mod API up to date ✅
Python tests 4 errors from my machine's setup (a global tests package, no launcher build), untouched here
Parity not run (--quick): the CI parity job picks the affected harnesses

Label: a fix, no feature label.


🔄 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/7133 **Author:** [@Akirabane](https://github.com/Akirabane) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/7067-minecart-world-border-2` --- ### 📝 Commits (3) - [`3720600`](https://github.com/horizon-rust/horizon/commit/37206002e1fbe0b2527a3dad647985ffb37bd154) Minecarts stop at the world border - [`baa5187`](https://github.com/horizon-rust/horizon/commit/baa51871cb7cf08217a63bbe19d469aba0111b87) Test a minecart-sized body against the world border - [`a5cdf9f`](https://github.com/horizon-rust/horizon/commit/a5cdf9fd53684c211fb190f2ab76b719dc2b6c18) Merge origin/main into fix/7067-minecart-world-border ### 📊 Changes **2 files changed** (+22 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/collisions.rs` (+19 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+3 -2) </details> ### 📄 Description > 🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review. Fixes #7067 ## What was wrong `Entity.move` reaches `CollisionGetter.getCollisions` for every entity, and `getBlockCollisions` adds `borderCollision(entity, box)`, so the world border stops a minecart as it does the player and, since #7077, a boat (read with `javap` on the 26.3 server jar, as in #7065). `Game::move_cart` (`game/minecarts.rs`) built its `EntityCollisions` with `border: None`, so a cart, and the player riding it, rolled straight through the border. Every cart move goes through `move_cart` (the old rail logic, the new `minecart_improvements` logic and `come_off_track`), so one line covers them all. ## What changed `game/minecarts.rs`: `move_cart` passes `self.border.geometry()` and the cart's x and z to `EntityCollisions`, as `tick_boat`, the player and the pistons do. One line of code and its comment. `horizon-client-render/src/collisions.rs`: one test, `a_minecart_sized_body_stops_at_the_border_wall`. Not touched, left to their own changes: dropped items (`entities.rs` also builds `EntityCollisions` with `border: None`), and the other members of the family (#7070, #7078, #7080). A LAN guest or a remote server's carts are interpolated from the host's packets (`remote_minecart_lerp` in `remote_vehicles.rs`), not moved by `move_cart`, so this fix on the host's side serves them; I did not run a LAN session. ## How it was checked In the game (`horizon-ctl launch --offscreen`, creative world, fresh game home), a flat strip of `rail[shape=east_west]` from x = -6 to 14, `worldborder center 0 0` then `worldborder set 10` (centre 0.5, so the walls are at x = -4.5 and 5.5), and `summon minecart 0.5 100.0625 0.5 {Motion:[0.4d,0.0d,0.0d]}`. The cart's x is read from `horizon-ctl status` (`carts`) and with `/data get entity` once it has stopped: | Build | Cart x when it stops | | --- | --- | | `origin/main` (the same code with `border: None`) | 10.49 (through the border, along the rails) | | this branch | 5.51 (stopped at the border) | 5.51 is the right value, not 5.5: vanilla's `WorldBorder.getCollisionShape` rounds the walls outwards (`floor(minX)`, `ceil(maxX)`, `border.rs:88`), so the wall a cart meets is at x = 6.0, and the cart (0.98 wide, so 0.49 each side) stops with its centre at 5.51. The test: a body the size of a minecart (0.98 × 0.7), 0.11 blocks short of the wall of a border 10 wide, moved 0.4 east (a cart's top speed) must move only 0.11. The expected value is worked out by hand from the cart's box and the wall, not read from the code. It covers `EntityCollisions` with a cart-sized box; it cannot catch the `border: None` itself, as `move_cart` needs a `Game`, which has no test fixture. The in-game run above is the check for that wiring. ## Self-check `tools/pr_ready.py --quick --base origin/main` before merging the latest `origin/main` (then `cargo fmt --check`, clippy `-D warnings` on `horizon-client` and `horizon-client-render`, and the new and `entity_skin` tests re-run after the merge): | Check | Result | | --- | --- | | Scope | 2 files, +22 −2 | | Cargo.lock | unchanged | | Public tree | ✅ | | rustfmt, clippy | ✅ | | tests: horizon-client, horizon-client-render | 1806 passed, 1 failed before the merge: `gfx::entity_skin::tests::the_shader_writes_what_the_cpu_reference_computes` (one float differs in the last digit on my GPU, a file this PR does not touch); it passes after merging the `entity_skin` change now on `main` | | mod API up to date | ✅ | | Python tests | 4 errors from my machine's setup (a global `tests` package, no launcher build), untouched here | | Parity | not run (`--quick`): the CI parity job picks the affected harnesses | Label: a fix, no `feature` label. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:38:22 +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#7362
No description provided.