[PR #7479] [MERGED] A Music page (an extra) plays the built-in tracks and leaves the off ones out #7623

Closed
opened 2026-11-03 07:21:02 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/music-picker


📝 Commits (6)

  • c6e49ac A Music page plays the built-in tracks and leaves the off ones out
  • 775981f The Music page is an extra, and lists every biome pool's tracks
  • 90acfe8 Music page: its headings are lang keys again
  • 6d036ac Merge main into #7479
  • 9e555b5 Music page: borrow the heading's key for tr
  • dbf5ea1 Merge main into #7479

📊 Changes

10 files changed (+842 additions, -48 deletions)

View changed files

📝 crates/horizon-client-render/src/extras.rs (+43 -2)
📝 crates/horizon-client-render/src/options_ui.rs (+253 -24)
📝 crates/horizon-client-render/src/sound_engine.rs (+7 -1)
📝 crates/horizon-client-render/src/sound_events.rs (+103 -14)
📝 crates/horizon-client/assets/horizon/lang/en_us.json (+17 -0)
📝 crates/horizon-client/src/game/music.rs (+18 -0)
📝 crates/horizon-client/src/game/options.rs (+3 -0)
📝 crates/horizon-client/src/game/startup_menu.rs (+4 -1)
📝 crates/horizon-client/src/music.rs (+373 -5)
📝 docs/extras.md (+21 -1)

📄 Description

🤖 Opened by JustKarkat's AI agent (ZCode), not by JustKarkat personally.

Fixes #6877

A player-facing feature and a Horizon extra: Extras → Sound → "Music page" (musicPage, off by default). Off, Music & Sounds is exactly vanilla's page and no pool is filtered. On, Music & Sounds gains a Music... button and the page lists every track the loaded sounds.json can play:

  • Left click a track: it plays now, from a pool that really has it. It takes the music manager's slot (the track already playing stops), and the situation's own music resumes when it ends.
  • On/Off on the right of a row: the track leaves every pool it plays in, so a situation whose tracks are all off plays nothing. Every track is on by default, so vanilla's random selection is unchanged. The off tracks persist as musicOff in horizon-extras.txt.

Every track is covered. The seven built-in situations come first (menu, overworld, creative, underwater, the End, boss, credits). Then the tracks only a biome's pool names — overworld deep dark, swamp, badlands, caves…, and the Nether's — are listed under Overworld biomes and Nether biomes. Vanilla shares those tracks between several biomes, so no heading claims one. A track several pools share is listed once, from the first pool that names it, so each row's "play now" has a pool that plays it and nothing is left out.

Where it lives:

  • SoundRegistry::sound_except (sound_events.rs) runs the same weighted walk as getSound, including nested "type": "event" references, with refused leaves at weight 0 so the pool re-normalises. SoundRegistry::tracks lists an event's own files.
  • MusicManager (music.rs) resolves the concrete sound with the off set (or exactly the chosen track), and SoundEngine::resolve keeps a sound a caller chose, since getOrResolve runs once. A "play now" track is not replaced while it plays.
  • music::track_groups builds the page's rows from the registry (pure, unit tested); MusicGroup holds MusicTrack { event, id } and the page's headings are made at run time (Row::Heading).
  • The page/events/rows are in options_ui.rs; the game fills the groups, plays rows and only filters pools while the extra is on (game/music.rs, game/options.rs). The startup menu ignores both events: it runs before the sound engine, so the page says the sounds are not loaded.

Tests: registry tracks/filtering (nested reference, all-refused), track_groups (base + biome + shared + record + non-music events:every track once, from a pool that has it), the manager (off track leaves the pool, all-off retries, play-now exact/stop/forced, unknown track), the extra's round-trip and the button appearing only when it is on, and the page's play and On/Off rows. tools/pr_ready.py --quick green (rustfmt, clippy, 3333 tests, doc tests, mod API); its only note is the 854-line scope.


🔄 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/7479 **Author:** [@JustKarkat](https://github.com/JustKarkat) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/music-picker` --- ### 📝 Commits (6) - [`c6e49ac`](https://github.com/horizon-rust/horizon/commit/c6e49ac73c9b25a55e879d613849fb2683016c42) A Music page plays the built-in tracks and leaves the off ones out - [`775981f`](https://github.com/horizon-rust/horizon/commit/775981f9a8a2447e2a37bd95732cd97d750f1745) The Music page is an extra, and lists every biome pool's tracks - [`90acfe8`](https://github.com/horizon-rust/horizon/commit/90acfe8039a2418c6c1e5cdc057d3967c6f34eaf) Music page: its headings are lang keys again - [`6d036ac`](https://github.com/horizon-rust/horizon/commit/6d036acb465dc2c7e4900ca6f69506e02e90ea7f) Merge main into #7479 - [`9e555b5`](https://github.com/horizon-rust/horizon/commit/9e555b53031aa85ebf41e5e5abaff1a41bfa85ce) Music page: borrow the heading's key for tr - [`dbf5ea1`](https://github.com/horizon-rust/horizon/commit/dbf5ea1396e7d1024be88c4c938ac8a9f4a5d82a) Merge main into #7479 ### 📊 Changes **10 files changed** (+842 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/extras.rs` (+43 -2) 📝 `crates/horizon-client-render/src/options_ui.rs` (+253 -24) 📝 `crates/horizon-client-render/src/sound_engine.rs` (+7 -1) 📝 `crates/horizon-client-render/src/sound_events.rs` (+103 -14) 📝 `crates/horizon-client/assets/horizon/lang/en_us.json` (+17 -0) 📝 `crates/horizon-client/src/game/music.rs` (+18 -0) 📝 `crates/horizon-client/src/game/options.rs` (+3 -0) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+4 -1) 📝 `crates/horizon-client/src/music.rs` (+373 -5) 📝 `docs/extras.md` (+21 -1) </details> ### 📄 Description > 🤖 Opened by JustKarkat's AI agent (ZCode), not by JustKarkat personally. Fixes #6877 A player-facing feature and a Horizon extra: **Extras → Sound → "Music page" (`musicPage`, off by default)**. Off, Music & Sounds is exactly vanilla's page and no pool is filtered. On, Music & Sounds gains a **Music...** button and the page lists every track the loaded `sounds.json` can play: - **Left click** a track: it plays now, from a pool that really has it. It takes the music manager's slot (the track already playing stops), and the situation's own music resumes when it ends. - **On/Off** on the right of a row: the track leaves every pool it plays in, so a situation whose tracks are all off plays nothing. Every track is on by default, so vanilla's random selection is unchanged. The off tracks persist as `musicOff` in `horizon-extras.txt`. **Every track is covered.** The seven built-in situations come first (menu, overworld, creative, underwater, the End, boss, credits). Then the tracks only a biome's pool names — overworld deep dark, swamp, badlands, caves…, and the Nether's — are listed under **Overworld biomes** and **Nether biomes**. Vanilla shares those tracks between several biomes, so no heading claims one. A track several pools share is listed once, from the first pool that names it, so each row's "play now" has a pool that plays it and nothing is left out. Where it lives: - `SoundRegistry::sound_except` (`sound_events.rs`) runs the same weighted walk as `getSound`, including nested `"type": "event"` references, with refused leaves at weight 0 so the pool re-normalises. `SoundRegistry::tracks` lists an event's own files. - `MusicManager` (`music.rs`) resolves the concrete sound with the off set (or exactly the chosen track), and `SoundEngine::resolve` keeps a sound a caller chose, since `getOrResolve` runs once. A "play now" track is not replaced while it plays. - `music::track_groups` builds the page's rows from the registry (pure, unit tested); `MusicGroup` holds `MusicTrack { event, id }` and the page's headings are made at run time (`Row::Heading`). - The page/events/rows are in `options_ui.rs`; the game fills the groups, plays rows and only filters pools while the extra is on (`game/music.rs`, `game/options.rs`). The startup menu ignores both events: it runs before the sound engine, so the page says the sounds are not loaded. Tests: registry tracks/filtering (nested reference, all-refused), `track_groups` (base + biome + shared + record + non-music events:every track once, from a pool that has it), the manager (off track leaves the pool, all-off retries, play-now exact/stop/forced, unknown track), the extra's round-trip and the button appearing only when it is on, and the page's play and On/Off rows. `tools/pr_ready.py --quick` green (rustfmt, clippy, 3333 tests, doc tests, mod API); its only note is the 854-line scope. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:21:02 +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#7623
No description provided.