Client logs: no warning for minecraft:missingno; say when no sounds loaded

- sprites: vanilla models name the missing texture on purpose (block/air.json's
  particle is minecraft:missingno), so using it is not worth a warning (#853).
- audio: when the resources hold no sounds.json, the game plays nothing on a
  working output and the log said only which device opened. It now says the
  sounds were not copied and how to fix it (#1035, #1076).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-21 17:37:45 +02:00
parent d128289ca6
commit 57cc113be4
3 changed files with 19 additions and 1 deletions
+9
View File
@@ -498,6 +498,15 @@ impl Audio {
}
fn with_output(root: &Path, output: bool) -> Self {
let registry = SoundRegistry::load(root);
if output && registry.is_empty() {
// The game then plays nothing on a working output (#1035, #1076).
log::warn!(
"Horizon: no sounds in {}: they were not copied from your Minecraft \
install; prepare the game again in the launcher (or run \
horizon-prepare sounds)",
root.join("assets").display()
);
}
let mixer = Arc::new(Mutex::new(Mixer::default()));
let opened = if output {
Self::open(mixer.clone())
@@ -246,6 +246,11 @@ impl SoundRegistry {
}
registry
}
/// No sound event at all: the resources hold no `sounds.json` (sounds not
/// imported from the player's launcher when the game was prepared).
pub fn is_empty(&self) -> bool {
self.events.is_empty()
}
/// One `sounds.json` (`Preparations.handleRegistration` for each entry).
/// `exists(namespace, path)` says whether a sound file is present.
pub fn add_file(&mut self, namespace: &str, text: &[u8], exists: &dyn Fn(&str, &str) -> bool) {
+5 -1
View File
@@ -147,7 +147,11 @@ impl Sprites {
match self.load(root, name) {
Ok(layer) => Ok(layer),
Err(e) => {
log::warn!("Horizon: using the missing texture for {name}: {e}");
// `MissingTextureAtlasSprite.getLocation()`: vanilla models name the
// missing texture on purpose (block/air.json's particle), #853.
if name != "minecraft:missingno" {
log::warn!("Horizon: using the missing texture for {name}: {e}");
}
// MissingTextureAtlasSprite.generateMissingImage: 16x16,
// magenta and black quarters.
let frame: Vec<u8> = (0..SPRITE_SIZE * SPRITE_SIZE)