[PR #315] [MERGED] Minecarts roll and rattle when ridden, and hits on vehicles sound #2481

Closed
opened 2026-11-02 15:56:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/315
Author: @ludovic111
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: feat/minecart-sounds


📝 Commits (1)

  • adb19ab Minecarts roll, rattle when ridden, and take hits with the attack sounds

📊 Changes

10 files changed (+324 additions, -17 deletions)

View changed files

📝 crates/horizon-client/examples/ambient_fixture.rs (+1 -0)
📝 crates/horizon-client/examples/sound_engine_fixture.rs (+39 -1)
📝 crates/horizon-client/src/clock.rs (+4 -0)
📝 crates/horizon-client/src/game.rs (+35 -10)
📝 crates/horizon-client/src/game/boats.rs (+1 -0)
📝 crates/horizon-client/src/game/minecarts.rs (+38 -0)
📝 crates/horizon-client/src/game/music.rs (+4 -0)
📝 crates/horizon-client/src/sound_engine.rs (+110 -2)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSoundEngineOracle.java (+42 -0)
📝 tools/test_sound_engine_parity.py (+50 -4)

📄 Description

Fixes #227. Thanks to Cosmic (@Online5277) for the report!

What

  • Rolling minecarts play entity.minecart.riding through vanilla's MinecartSoundInstance: one looping instance per minecart in the level, started silent when the cart joins the level (ClientPacketListener.postAddEntitySoundInstance), following the cart (its float-rounded position), with volume lerp(clamp(speed, 0, 0.5), 0, 0.7) above 0.01 blocks/tick and silence when the tick rate is frozen. It stops when the cart leaves the level (broken, exploded, unloaded). Its pitch stays 1, as in vanilla, where the instance's own pitch field shadows the one the engine reads.
  • Riding a minecart starts LocalPlayer.startRiding's two RidingMinecartSoundInstances (entity.minecart.inside and entity.minecart.inside.underwater, unattenuated, clampedLerp(speed, 0, 0.75), each silent when the player's underwater state doesn't match), stopped when the player gets out.
  • Hitting a minecart or a boat plays Player.attack's sounds, as for mobs: knockback when sprinting at full strength, then strong or weak (vehicles always take the hit and can't be hit critically). Vanilla has no minecart hurt or break sound of its own; these are what you hear. The attack-strength formula moves to attack_strength_scale(), which the mob attack now uses too.

Why

Minecarts made no sound at all: none of these instances existed, and vehicle hits were silent.

How tested

The sound_engine harness runs vanilla's real SoundManager/SoundEngine (OpenAL Soft null device). It now also replays MinecartSoundInstance and RidingMinecartSoundInstance for scripted and fuzzed minecart states: speeds around the 0.01, 0.5 and 1.0 thresholds, frozen ticks, riding and getting out, the player under water, removed carts. It compares every AL source parameter after every step: 335,665 lines match (11,167 steps).

Self-check (one integration commit of #227, #265 and #222 on origin/main 68ec2236, Mac mini):

cargo fmt --all --check                                        ok
cargo clippy --workspace --all-targets -- -D warnings          ok
cargo test -p horizon-client                                   632 + 38 + 15 + 2 + 2 + 1 passed, 0 failed
python3 tools/parity.py --changed origin/main                  79 passed, 0 failed in 15.3 min
python3 tools/parity.py sound_engine                           PASS (335,665 lines match, 11,167 steps)

In game: not heard. Games on the Mac mini run with HORIZON_NO_AUDIO=1, so the sound engine never starts there. The harness above checks the instances against vanilla instead.

Needs Ludovic

A listen in game: ride a minecart down a track and hit one.

🤖 Generated with Claude Code


🔄 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/315 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/minecart-sounds` --- ### 📝 Commits (1) - [`adb19ab`](https://github.com/horizon-rust/horizon/commit/adb19abd4ca53bd772fb6900b45ca983d2013db0) Minecarts roll, rattle when ridden, and take hits with the attack sounds ### 📊 Changes **10 files changed** (+324 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/ambient_fixture.rs` (+1 -0) 📝 `crates/horizon-client/examples/sound_engine_fixture.rs` (+39 -1) 📝 `crates/horizon-client/src/clock.rs` (+4 -0) 📝 `crates/horizon-client/src/game.rs` (+35 -10) 📝 `crates/horizon-client/src/game/boats.rs` (+1 -0) 📝 `crates/horizon-client/src/game/minecarts.rs` (+38 -0) 📝 `crates/horizon-client/src/game/music.rs` (+4 -0) 📝 `crates/horizon-client/src/sound_engine.rs` (+110 -2) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSoundEngineOracle.java` (+42 -0) 📝 `tools/test_sound_engine_parity.py` (+50 -4) </details> ### 📄 Description Fixes #227. Thanks to Cosmic (@Online5277) for the report! ## What - **Rolling minecarts** play `entity.minecart.riding` through vanilla's `MinecartSoundInstance`: one looping instance per minecart in the level, started silent when the cart joins the level (`ClientPacketListener.postAddEntitySoundInstance`), following the cart (its float-rounded position), with volume `lerp(clamp(speed, 0, 0.5), 0, 0.7)` above 0.01 blocks/tick and silence when the tick rate is frozen. It stops when the cart leaves the level (broken, exploded, unloaded). Its pitch stays 1, as in vanilla, where the instance's own `pitch` field shadows the one the engine reads. - **Riding a minecart** starts `LocalPlayer.startRiding`'s two `RidingMinecartSoundInstance`s (`entity.minecart.inside` and `entity.minecart.inside.underwater`, unattenuated, `clampedLerp(speed, 0, 0.75)`, each silent when the player's underwater state doesn't match), stopped when the player gets out. - **Hitting a minecart or a boat** plays `Player.attack`'s sounds, as for mobs: knockback when sprinting at full strength, then strong or weak (vehicles always take the hit and can't be hit critically). Vanilla has no minecart hurt or break sound of its own; these are what you hear. The attack-strength formula moves to `attack_strength_scale()`, which the mob attack now uses too. ## Why Minecarts made no sound at all: none of these instances existed, and vehicle hits were silent. ## How tested The `sound_engine` harness runs vanilla's real `SoundManager`/`SoundEngine` (OpenAL Soft null device). It now also replays `MinecartSoundInstance` and `RidingMinecartSoundInstance` for scripted and fuzzed minecart states: speeds around the 0.01, 0.5 and 1.0 thresholds, frozen ticks, riding and getting out, the player under water, removed carts. It compares every AL source parameter after every step: **335,665 lines match** (11,167 steps). Self-check (one integration commit of #227, #265 and #222 on origin/main 68ec2236, Mac mini): ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client 632 + 38 + 15 + 2 + 2 + 1 passed, 0 failed python3 tools/parity.py --changed origin/main 79 passed, 0 failed in 15.3 min python3 tools/parity.py sound_engine PASS (335,665 lines match, 11,167 steps) ``` In game: not heard. Games on the Mac mini run with `HORIZON_NO_AUDIO=1`, so the sound engine never starts there. The harness above checks the instances against vanilla instead. ## Needs Ludovic A listen in game: ride a minecart down a track and hit one. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:34 +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#2481
No description provided.