Merge pull request #2472 from kacpherek/fix/music-frequency
🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3's `MusicManager.MusicFrequency` and the option's listener (`setMinutesBetweenSongs`). I pushed one fix: in `SoundOptionsScreen` Music Frequency starts its own row (beside Music Toast), not beside Show Subtitles. Gate: this wave's 50 PRs merged on main in one tree (union 9033a9c3b): fmt and clippy `-D warnings` clean, the horizon-client (1136 lib plus the integration tests), horizon-client-core (37), horizon-world (165) and horizon-protocol (100) tests pass, the fast build links, and the 140 harnesses `parity.py` picks for the tree's changed files pass on playhorizon (remote_fireworks, a known load flake there, passed on a rerun on a quiet Mac mini). `lan_e2e.py` passes 14 checks with the host on its server thread and in-frame (chest, xp, damage, kills, projectiles, mobs, drops, body, stopsound, digging, instant_digging, books, knockback, barter); `hurt` fails on main too when run after `damage` (check-order dependency, not this wave). Thanks @kacpherek!
This commit is contained in:
@@ -12707,7 +12707,14 @@ impl<'a> Game<'a> {
|
||||
level,
|
||||
session_lock: None,
|
||||
audio,
|
||||
music: Default::default(),
|
||||
music: {
|
||||
// The manager starts with the saved option (MusicManager's constructor).
|
||||
let mut music = horizon_client::music::MusicManager::default();
|
||||
music.frequency = horizon_client::music::MusicFrequency::parse(
|
||||
&settings.file.name("musicFrequency"),
|
||||
);
|
||||
music
|
||||
},
|
||||
ambience: Default::default(),
|
||||
sound_paused: false,
|
||||
cart_sounds: HashSet::new(),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use super::Game;
|
||||
use horizon_client::{
|
||||
blocks::Fluid,
|
||||
music::{BackgroundMusic, Music, Situation},
|
||||
music::{BackgroundMusic, Music, MusicFrequency, Situation},
|
||||
sound_engine::TickContext,
|
||||
};
|
||||
|
||||
@@ -11,6 +11,11 @@ impl Game<'_> {
|
||||
/// `Minecraft.tick` -> `MusicManager.tick`, once per client tick.
|
||||
pub(super) fn tick_music(&mut self) {
|
||||
let (music, volume) = self.situational_music();
|
||||
// Options.musicFrequency's listener: MusicManager.setMinutesBetweenSongs.
|
||||
let frequency = MusicFrequency::parse(&self.settings.file.name("musicFrequency"));
|
||||
if frequency != self.music.frequency {
|
||||
self.music.set_frequency(frequency, music.as_ref());
|
||||
}
|
||||
// LevelLoadingScreen: no new track before the player is in the world.
|
||||
let loading = self.title.is_none() && self.player.is_none() && self.win.is_none();
|
||||
self.music
|
||||
|
||||
@@ -67,6 +67,7 @@ pub enum Opt {
|
||||
ReducedDebugInfo,
|
||||
HighContrast,
|
||||
ShowSubtitles,
|
||||
MusicFrequency,
|
||||
NotificationDisplayTime,
|
||||
Narrator,
|
||||
TextBackground,
|
||||
@@ -192,6 +193,7 @@ impl Opt {
|
||||
Opt::NarratorHotkey => "narratorHotkey",
|
||||
Opt::RotateWithMinecarts => "rotateWithMinecart",
|
||||
Opt::HighContrastBlockOutlines => "highContrastBlockOutline",
|
||||
Opt::MusicFrequency => "musicFrequency",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -248,6 +250,7 @@ impl Opt {
|
||||
Opt::ReducedDebugInfo => "options.reducedDebugInfo",
|
||||
Opt::HighContrast => "options.accessibility.high_contrast",
|
||||
Opt::ShowSubtitles => "options.showSubtitles",
|
||||
Opt::MusicFrequency => "options.music_frequency",
|
||||
Opt::NotificationDisplayTime => "options.notifications.display_time",
|
||||
Opt::Narrator => "options.narrator",
|
||||
Opt::TextBackground => "options.accessibility.text_background",
|
||||
@@ -578,6 +581,11 @@ impl Opt {
|
||||
Opt::ReducedDebugInfo => on_off(s.reduced_debug_info),
|
||||
Opt::HighContrast => on_off(s.high_contrast),
|
||||
Opt::ShowSubtitles => on_off(s.show_subtitles),
|
||||
Opt::MusicFrequency => tr([
|
||||
"options.music_frequency.default",
|
||||
"options.music_frequency.frequent",
|
||||
"options.music_frequency.constant",
|
||||
][s.file.int("musicFrequency").clamp(0, 2) as usize]),
|
||||
Opt::ForceUnicode => on_off(s.force_unicode),
|
||||
Opt::JapaneseGlyphs => on_off(s.japanese_glyphs),
|
||||
Opt::PadEnabled => on_off(s.controller.enabled),
|
||||
@@ -747,6 +755,11 @@ impl Opt {
|
||||
Opt::ReducedDebugInfo => s.reduced_debug_info = !s.reduced_debug_info,
|
||||
Opt::HighContrast => s.high_contrast = !s.high_contrast,
|
||||
Opt::ShowSubtitles => s.show_subtitles = !s.show_subtitles,
|
||||
Opt::MusicFrequency => {
|
||||
let n = next(s.file.int("musicFrequency").clamp(0, 2) as u8, 3);
|
||||
s.file
|
||||
.set("musicFrequency", crate::options_file::V::Int(i32::from(n)));
|
||||
}
|
||||
Opt::ForceUnicode => s.force_unicode = !s.force_unicode,
|
||||
Opt::JapaneseGlyphs => s.japanese_glyphs = !s.japanese_glyphs,
|
||||
Opt::PadEnabled => s.controller.enabled = !s.controller.enabled,
|
||||
@@ -1412,6 +1425,9 @@ impl OptionsUi {
|
||||
let others: Vec<Opt> = (1..SOUND_SOURCES.len()).map(Opt::Volume).collect();
|
||||
rows.extend(pairs(&others));
|
||||
rows.extend(pairs(&[Opt::ShowSubtitles]));
|
||||
// SoundOptionsScreen: Music Frequency starts the next row (with
|
||||
// Music Toast, not in Horizon yet).
|
||||
rows.extend(pairs(&[Opt::MusicFrequency]));
|
||||
rows
|
||||
}
|
||||
Page::Controls => {
|
||||
|
||||
Reference in New Issue
Block a user