-
Bug
-
Resolution: Works As Intended
-
None
-
Minecraft 16w38a
-
Unconfirmed
Note: This might be WAI.
The bug
Sound file names referenced by sound entry in the sounds.json file do not need the prefix minecraft. However, if a resource pack contains a sounds.json in an external folder (for example custom), then all sound file names in this sounds.json file need the prefix custom:, otherwise they use minecraft: as prefix. For plugins this might be pretty annoying and inconvenient because they will very likely refer to many external sound files.
Example
Resource pack structure:
- pack.mcmeta
- assets
- minecraft
- sounds.json
{ "testfolder.testsound": { "category": "ambient", "sounds": [ "testfolder/testsound" ] } }
- sounds.json
- custom
- sounds.json
{ "testfolder.testsound": { "category": "ambient", "sounds": [ "testfolder/testsound" ] } }
- sounds.json
- minecraft
The bug is that the sound of custom:testfolder.testsound is loaded as minecraft:testfolder/testsound despite being in the custom folder. You need to add custom: as prefix to prevent that.
How to reproduce
- Load the attached resource pack (External sound test.zip)
- Use the following command (does not use prefix)
/playsound custom:testfolder.testsound ambient @p
→ The sound won't play because it is loaded with the minecraft prefix
- Use the following command
/playsound custom:testfolder.testsound.prefix ambient @p
→ The sound will play because the prefix is provided
The reason
The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.
This happens because the method net.minecraft.client.audio.SoundListSerializer.deserializeSound(JsonObject) creates a Sound object with the given name, which uses the minecraft: prefix if no other prefix is specified.