[PR #1317] [MERGED] Minecarts push each other in their own ticks, as vanilla does #3482

Closed
opened 2026-11-03 04:09:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1317
Author: @levzzz5154
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @ludovic111

Base: main ← Head: fix/minecart-collisions


📝 Commits (1)

  • 18bf8cd Minecarts push each other in their own ticks, as vanilla does

📊 Changes

1 file changed (+68 additions, -51 deletions)

View changed files

📝 crates/horizon-client/src/game/minecarts.rs (+68 -51)

📄 Description

What and why

Minecarts placed inside each other never split apart or start moving, unlike Java. Horizon pushed every pair of carts once per tick, before any cart moved. Carts at exactly the same spot stay exactly overlapping, and AbstractMinecart.push skips distances under 1e-4, so nothing ever happens.

Vanilla does the pushing at the end of each cart's own tick (OldMinecartBehavior.tick → pushAndPickupEntities): after a cart moves, every other cart in its box (0.2 wider on each side) gets push(cart). Because one cart has already moved when it pushes the next, stacked carts separate and push each other along the rail. This PR moves cart-to-cart pushes into each cart's tick, the ridden cart included, and matches pushOtherMinecart's details: the Mth sine-table facing, the float thresholds (1.0E-4f, 0.2f, 0.8f) and the order of the velocity arithmetic. The player pushing a cart is unchanged.

Tested in game: two minecarts summoned at the same spot on a straight rail, pushed by walking into them. They now split about 0.3 blocks apart and run down the rail together, as in Java.

Vanilla reference

  • AbstractMinecart.push(Entity), AbstractMinecart.pushOtherMinecart
  • OldMinecartBehavior.tick, OldMinecartBehavior.pushAndPickupEntities

No harness yet: there is no minecart parity harness to extend. Happy to add one if you'd like it in this PR.

Self-check

Run with --quick: this machine has no parity cache yet and the 246 selected harnesses would take hours, so they're left to the run-parity label.

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at 07e717977, 3 min 26 s)

Check Result
Scope ✅ 1 files, +68 −51
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (4 s)
clippy ✅ (41 s)
tests: horizon-client ✅ 1137 passed (2 min 38 s)
doc tests ✅ 0 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 246 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, datafix, decorated_region, decoration, decoration_region, dedicated_server, delta, density and 234 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/1317 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/minecart-collisions` --- ### 📝 Commits (1) - [`18bf8cd`](https://github.com/horizon-rust/horizon/commit/18bf8cd2ef0fda0582bf59540ade05d0ce5a9d27) Minecarts push each other in their own ticks, as vanilla does ### 📊 Changes **1 file changed** (+68 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/minecarts.rs` (+68 -51) </details> ### 📄 Description ## What and why Minecarts placed inside each other never split apart or start moving, unlike Java. Horizon pushed every pair of carts once per tick, before any cart moved. Carts at exactly the same spot stay exactly overlapping, and `AbstractMinecart.push` skips distances under 1e-4, so nothing ever happens. Vanilla does the pushing at the end of each cart's own tick (`OldMinecartBehavior.tick` → `pushAndPickupEntities`): after a cart moves, every other cart in its box (0.2 wider on each side) gets `push(cart)`. Because one cart has already moved when it pushes the next, stacked carts separate and push each other along the rail. This PR moves cart-to-cart pushes into each cart's tick, the ridden cart included, and matches `pushOtherMinecart`'s details: the `Mth` sine-table facing, the float thresholds (`1.0E-4f`, `0.2f`, `0.8f`) and the order of the velocity arithmetic. The player pushing a cart is unchanged. Tested in game: two minecarts summoned at the same spot on a straight rail, pushed by walking into them. They now split about 0.3 blocks apart and run down the rail together, as in Java. ## Vanilla reference - `AbstractMinecart.push(Entity)`, `AbstractMinecart.pushOtherMinecart` - `OldMinecartBehavior.tick`, `OldMinecartBehavior.pushAndPickupEntities` No harness yet: there is no minecart parity harness to extend. Happy to add one if you'd like it in this PR. ## Self-check Run with `--quick`: this machine has no parity cache yet and the 246 selected harnesses would take hours, so they're left to the `run-parity` label. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at 07e717977, 3 min 26 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +68 −51 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (4 s) | | clippy | ✅ (41 s) | | tests: horizon-client | ✅ 1137 passed (2 min 38 s) | | doc tests | ✅ 0 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 246 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, datafix, decorated_region, decoration, decoration_region, dedicated_server, delta, density and 234 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:09:50 +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#3482
No description provided.