[PR #2763] [MERGED] Stop the menu music when a world loads #4588

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2763
Author: @ASOwnerYT
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: claude/issue-2746-fix-pr-f0eb69


📝 Commits (1)

  • 985ece8 Stop the menu music when a world loads

📊 Changes

5 files changed (+75 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+6 -0)
📝 crates/horizon-client/src/game/music.rs (+16 -2)
📝 crates/horizon-client/src/game/remote.rs (+12 -0)
📝 crates/horizon-client/src/music.rs (+28 -0)
📝 tools/test_music_parity.py (+13 -0)

📄 Description

🤖 Opened by asowneryt's AI agent (Claude Code), not by asowneryt himself.

Fixes #2746.

What and why

The title-screen track (minecraft:music.menu) kept playing in a world until it ended. In vanilla, Minecraft.setLevel → updateLevelInEngines calls SoundManager.stop(), which stops every sound, so the menu track ends when you join. The music manager's track is then inactive, and on its next tick it waits the level's music delay (12000–24000 ticks for music.game). Horizon stopped sounds only when leaving a world. The game music doesn't replace the current track, so the menu track kept going.

  • A server's client (single player's server thread, LAN, multiplayer) stops every sound when it makes a new level in enter_remote_dimension: on Login, and on a Respawn into another level. A Respawn that changes dimension also calls MusicManager.stopPlaying, as handleRespawn does.
  • In-frame does the same when the opened world's first player is placed (spawn_player).
  • In the world from Login on. Vanilla's Minecraft.player exists from handleLogin on. Here the player is made at the first teleport, so getSituationalMusic now counts a logged-in client as in the world, with the camera at the origin. Without this, the few ticks between Login and the teleport still ask for menu music. With the menu track stopped, canReplace would then draw a 0–10-tick delay, and the first game track would start almost at once.

Vanilla reference

  • Minecraft.setLevel, updateLevelInEngines(level, stopSound), getSituationalMusic
  • SoundManager.stop → SoundEngine.stopAll
  • ClientPacketListener.handleLogin, handleRespawn (setLevel for a new ClientLevel, then getMusicManager().stopPlaying() when the dimension changed)
  • MusicManager.tick, stopPlaying

Harness: test_music_parity.py runs the real MusicManager over the real SoundEngine. Its script now includes the join: a menu-like replacing track plays, stopall, non-replacing game music with loading ticks, then a dimension change's stopall + stop. music and situational_music pass. New unit test: music::tests::a_new_level_stops_menu_music_and_waits_for_game_music.

Not checked in the running game: agent runs set HORIZON_NO_AUDIO=1, and without an output the sound engine never loads, so no track plays.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on cachyos, against upstream/main at 512545ade, 24 min 49 s)

Check Result
Scope ✅ 5 files, +75 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 331 passed (17 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 22 s)
tests: horizon-client ✅ 1319 passed (2 min 12 s)
doc tests ✅ 0 passed (24 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 41 affected, 34 passed, failed: entity_model, save_roundtrip, spawn_loot, world_reopen (20 min 16 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The four parity failures come from this machine, not the change: save_roundtrip, spawn_loot and world_reopen need vscreen, which isn't installed (FileNotFoundError: 'vscreen'). entity_model's oracle runs on JDK 27 rather than the pinned 25 and throws IllegalAccessException on Bat.flyAnimationState; the layers it compared show 0 differences. They need CI's parity run.

🤖 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/2763 **Author:** [@ASOwnerYT](https://github.com/ASOwnerYT) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `claude/issue-2746-fix-pr-f0eb69` --- ### 📝 Commits (1) - [`985ece8`](https://github.com/horizon-rust/horizon/commit/985ece811b73e6f90e573a0234ff0a7d67b69942) Stop the menu music when a world loads ### 📊 Changes **5 files changed** (+75 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -0) 📝 `crates/horizon-client/src/game/music.rs` (+16 -2) 📝 `crates/horizon-client/src/game/remote.rs` (+12 -0) 📝 `crates/horizon-client/src/music.rs` (+28 -0) 📝 `tools/test_music_parity.py` (+13 -0) </details> ### 📄 Description > 🤖 Opened by asowneryt's AI agent (Claude Code), not by asowneryt himself. Fixes #2746. ## What and why The title-screen track (`minecraft:music.menu`) kept playing in a world until it ended. In vanilla, `Minecraft.setLevel` → `updateLevelInEngines` calls `SoundManager.stop()`, which stops every sound, so the menu track ends when you join. The music manager's track is then inactive, and on its next tick it waits the level's music delay (12000–24000 ticks for `music.game`). Horizon stopped sounds only when leaving a world. The game music doesn't replace the current track, so the menu track kept going. - **A server's client** (single player's server thread, LAN, multiplayer) stops every sound when it makes a new level in `enter_remote_dimension`: on Login, and on a Respawn into another level. A Respawn that changes dimension also calls `MusicManager.stopPlaying`, as `handleRespawn` does. - **In-frame** does the same when the opened world's first player is placed (`spawn_player`). - **In the world from Login on.** Vanilla's `Minecraft.player` exists from `handleLogin` on. Here the player is made at the first teleport, so `getSituationalMusic` now counts a logged-in client as in the world, with the camera at the origin. Without this, the few ticks between Login and the teleport still ask for menu music. With the menu track stopped, `canReplace` would then draw a 0–10-tick delay, and the first game track would start almost at once. ## Vanilla reference - `Minecraft.setLevel`, `updateLevelInEngines(level, stopSound)`, `getSituationalMusic` - `SoundManager.stop` → `SoundEngine.stopAll` - `ClientPacketListener.handleLogin`, `handleRespawn` (`setLevel` for a new `ClientLevel`, then `getMusicManager().stopPlaying()` when the dimension changed) - `MusicManager.tick`, `stopPlaying` Harness: `test_music_parity.py` runs the real `MusicManager` over the real `SoundEngine`. Its script now includes the join: a menu-like replacing track plays, `stopall`, non-replacing game music with loading ticks, then a dimension change's `stopall` + `stop`. `music` and `situational_music` pass. New unit test: `music::tests::a_new_level_stops_menu_music_and_waits_for_game_music`. Not checked in the running game: agent runs set `HORIZON_NO_AUDIO=1`, and without an output the sound engine never loads, so no track plays. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on cachyos, against upstream/main at 512545ade, 24 min 49 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +75 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 331 passed (17 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 22 s) | | tests: horizon-client | ✅ 1319 passed (2 min 12 s) | | doc tests | ✅ 0 passed (24 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 41 affected, 34 passed, failed: entity_model, save_roundtrip, spawn_loot, world_reopen (20 min 16 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The four parity failures come from this machine, not the change: `save_roundtrip`, `spawn_loot` and `world_reopen` need `vscreen`, which isn't installed (`FileNotFoundError: 'vscreen'`). `entity_model`'s oracle runs on JDK 27 rather than the pinned 25 and throws `IllegalAccessException` on `Bat.flyAnimationState`; the layers it compared show 0 differences. They need CI's parity run. 🤖 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-03 04:18:17 +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#4588
No description provided.