[PR #5004] [CLOSED] Minecarts: minecart_improvements picks the smoother physics #6001

Closed
opened 2026-11-03 05:16:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5004
Author: @masa-masa-0314
Created: 10/31/2026
Status: ❌ Closed

Base: main ← Head: feat/minecart-improvements


📝 Commits (10+)

  • a5d6d8a Biomes: the palette holds a world's biomes too
  • ce83c14 Commands: a world's packs complete and match their biomes and tags
  • 6ea12f7 Data packs: the world's chunks and the game read one biome table
  • 7eabfed Data packs: one pack list builds the biomes, the worldgen and the commands
  • ccb19c6 Biomes: the table survives world switches, and tags nest
  • 10fa933 Create World: the Experiments screen, the feature packs and dropped packs
  • 6975e9c Experiments: the More tab's button opens, and a world keeps its selection
  • 228b7d3 Fix packed_biomes call after merging main; restore world_worldgen_overrides's doc comment
  • 072cc61 Create World: the preparing screen and the experimental-features warning
  • 5acff38 Create World: the world's enabled features persist in level.dat

📊 Changes

35 files changed (+1484 additions, -172 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk.rs (+1 -1)
📝 crates/horizon-client-render/src/datapack.rs (+129 -7)
📝 crates/horizon-client/src/game.rs (+115 -6)
📝 crates/horizon-client/src/game/commands.rs (+24 -7)
📝 crates/horizon-client/src/game/commands/execute.rs (+12 -24)
📝 crates/horizon-client/src/game/commands/terrain_cmds.rs (+6 -2)
📝 crates/horizon-client/src/game/creatures.rs (+2 -2)
📝 crates/horizon-client/src/game/dedicated.rs (+1 -1)
📝 crates/horizon-client/src/game/dispense_fixture.rs (+1 -1)
📝 crates/horizon-client/src/game/fishing.rs (+1 -1)
📝 crates/horizon-client/src/game/functions.rs (+72 -30)
📝 crates/horizon-client/src/game/initial_spawn.rs (+1 -1)
📝 crates/horizon-client/src/game/integrated.rs (+8 -0)
📝 crates/horizon-client/src/game/lan.rs (+29 -18)
📝 crates/horizon-client/src/game/minecarts.rs (+235 -5)
📝 crates/horizon-client/src/game/moving_pistons.rs (+1 -1)
📝 crates/horizon-client/src/game/music.rs (+1 -1)
📝 crates/horizon-client/src/game/natural_spawning.rs (+1 -1)
📝 crates/horizon-client/src/game/nether_portal.rs (+11 -9)
📝 crates/horizon-client/src/game/options.rs (+2 -1)

...and 15 more files

📄 Description

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

What and why

AbstractMinecart chooses its behavior by the world's features: with minecart_improvements the new behavior runs. Ported from NewMinecartBehavior (26.3 decompile):

  • the slope slide grows with the speed (max(0.0078125, horizontal * 0.02)) — a descending cart keeps its pace;
  • the empty cart slows half as fast (0.975 over 0.96);
  • the speed cap is a vector normalization (min(len, maxSpeed)) instead of the old per-axis clamp;
  • a powered rail boosts +0.06 along the movement, or pushes a resting cart 0.2 away from the signal's side (getRedstoneDirection);
  • a track iteration carries leftover distance across rails (a tick crosses as many as it needs), a hill projects the Y onto the slope, and a V of opposing slopes rests a slow cart (restAtVShape, threshold 0.005).

Without the flag the old physics runs unchanged. The client-side lerp steps (MinecartStep) are not ported: Horizon interpolates its own previous/position.

Stacked on #4975 (← #4957 ← #4948 ← #4619 ← #4577), whose enabled_features the gate reads.

Vanilla reference

Decompiled from the 26.3 client jar (Vineflower): AbstractMinecart's behavior pick, NewMinecartBehavior (moveAlongTrack, calculateTrackSpeed, stepAlongTrack, restAtVShape, isDecending, getSlowdownFactor, getMaxSpeed), MinecartBehavior's contract.

Self-check

rustfmt ✅, clippy -D warnings ✅, tests ✅ (client 906, render 688, world 227). The gate itself is verified in-game-style: a world whose level.dat enables the flag lists minecart_improvements on /datapack list while a world without it does not. The physics comparison probe (two worlds differing only in the flag, TNT-cart-into-a-wall as the observable) hit headless-mode limits — the probe cannot read entity positions and Horizon's TNT carts do not explode on wall collisions (the collision zeroes the speed the check reads), so the coasting-distance comparison is left for in-game validation: place a cart on a boosted flat track, it coasts visibly farther with the flag on.

Screenshots

Not included: this machine's offscreen renderer draws a blank window.


🔄 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/5004 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/minecart-improvements` --- ### 📝 Commits (10+) - [`a5d6d8a`](https://github.com/horizon-rust/horizon/commit/a5d6d8af2aed8c015e85fa976f58ac9ee212a8bd) Biomes: the palette holds a world's biomes too - [`ce83c14`](https://github.com/horizon-rust/horizon/commit/ce83c14926968888e8386c8481150de5be7307ae) Commands: a world's packs complete and match their biomes and tags - [`6ea12f7`](https://github.com/horizon-rust/horizon/commit/6ea12f710f6a76c68eef7077da5b1bc8d81b57aa) Data packs: the world's chunks and the game read one biome table - [`7eabfed`](https://github.com/horizon-rust/horizon/commit/7eabfedc8d9aa1c49f6dac9b2d3696124c4fb6ed) Data packs: one pack list builds the biomes, the worldgen and the commands - [`ccb19c6`](https://github.com/horizon-rust/horizon/commit/ccb19c6cfeddf003f15ce5d1b793413e6eed8347) Biomes: the table survives world switches, and tags nest - [`10fa933`](https://github.com/horizon-rust/horizon/commit/10fa933647dd3f97d0fbb9e8a227986cc95207bf) Create World: the Experiments screen, the feature packs and dropped packs - [`6975e9c`](https://github.com/horizon-rust/horizon/commit/6975e9c9e1ce92d3377f40b1e601d2e5a5940eb2) Experiments: the More tab's button opens, and a world keeps its selection - [`228b7d3`](https://github.com/horizon-rust/horizon/commit/228b7d349179711fd45264f34a472fe5cdfccfb2) Fix packed_biomes call after merging main; restore world_worldgen_overrides's doc comment - [`072cc61`](https://github.com/horizon-rust/horizon/commit/072cc61277ffc2c52877fd246cdedfe7e3b9a921) Create World: the preparing screen and the experimental-features warning - [`5acff38`](https://github.com/horizon-rust/horizon/commit/5acff3836c1d778b9bd25e4a8afd461377608990) Create World: the world's enabled features persist in level.dat ### 📊 Changes **35 files changed** (+1484 additions, -172 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk.rs` (+1 -1) 📝 `crates/horizon-client-render/src/datapack.rs` (+129 -7) 📝 `crates/horizon-client/src/game.rs` (+115 -6) 📝 `crates/horizon-client/src/game/commands.rs` (+24 -7) 📝 `crates/horizon-client/src/game/commands/execute.rs` (+12 -24) 📝 `crates/horizon-client/src/game/commands/terrain_cmds.rs` (+6 -2) 📝 `crates/horizon-client/src/game/creatures.rs` (+2 -2) 📝 `crates/horizon-client/src/game/dedicated.rs` (+1 -1) 📝 `crates/horizon-client/src/game/dispense_fixture.rs` (+1 -1) 📝 `crates/horizon-client/src/game/fishing.rs` (+1 -1) 📝 `crates/horizon-client/src/game/functions.rs` (+72 -30) 📝 `crates/horizon-client/src/game/initial_spawn.rs` (+1 -1) 📝 `crates/horizon-client/src/game/integrated.rs` (+8 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+29 -18) 📝 `crates/horizon-client/src/game/minecarts.rs` (+235 -5) 📝 `crates/horizon-client/src/game/moving_pistons.rs` (+1 -1) 📝 `crates/horizon-client/src/game/music.rs` (+1 -1) 📝 `crates/horizon-client/src/game/natural_spawning.rs` (+1 -1) 📝 `crates/horizon-client/src/game/nether_portal.rs` (+11 -9) 📝 `crates/horizon-client/src/game/options.rs` (+2 -1) _...and 15 more files_ </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What and why `AbstractMinecart` chooses its behavior by the world's features: with `minecart_improvements` the new behavior runs. Ported from `NewMinecartBehavior` (26.3 decompile): - the slope slide grows with the speed (`max(0.0078125, horizontal * 0.02)`) — a descending cart keeps its pace; - the empty cart slows half as fast (0.975 over 0.96); - the speed cap is a vector normalization (`min(len, maxSpeed)`) instead of the old per-axis clamp; - a powered rail boosts `+0.06` along the movement, or pushes a resting cart 0.2 away from the signal's side (`getRedstoneDirection`); - a track iteration carries leftover distance across rails (a tick crosses as many as it needs), a hill projects the Y onto the slope, and a V of opposing slopes rests a slow cart (`restAtVShape`, threshold 0.005). Without the flag the old physics runs unchanged. The client-side lerp steps (`MinecartStep`) are not ported: Horizon interpolates its own previous/position. Stacked on #4975 (← #4957 ← #4948 ← #4619 ← #4577), whose `enabled_features` the gate reads. ## Vanilla reference Decompiled from the 26.3 client jar (Vineflower): `AbstractMinecart`'s behavior pick, `NewMinecartBehavior` (moveAlongTrack, calculateTrackSpeed, stepAlongTrack, restAtVShape, isDecending, getSlowdownFactor, getMaxSpeed), `MinecartBehavior`'s contract. ## Self-check rustfmt ✅, clippy `-D warnings` ✅, tests ✅ (client 906, render 688, world 227). The gate itself is verified in-game-style: a world whose level.dat enables the flag lists `minecart_improvements` on `/datapack list` while a world without it does not. The physics comparison probe (two worlds differing only in the flag, TNT-cart-into-a-wall as the observable) hit headless-mode limits — the probe cannot read entity positions and Horizon's TNT carts do not explode on wall collisions (the collision zeroes the speed the check reads), so the coasting-distance comparison is left for in-game validation: place a cart on a boosted flat track, it coasts visibly farther with the flag on. ## Screenshots Not included: this machine's offscreen renderer draws a blank window. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:32 +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#6001
No description provided.