Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-107255

Sounds in sound list of external sounds.json require prefix

    XMLWordPrintable

    Details

    • Confirmation Status:
      Unconfirmed

      Description

      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"
                    ]
                }
            }
            
        • custom
          • sounds.json
            {
                "testfolder.testsound": {
                    "category": "ambient",
                    "sounds": [
                        "testfolder/testsound"
                    ]
                }
            }
            

      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

      1. Load the attached resource pack (External sound test.zip)
      2. 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

      3. 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.

        Attachments

          Activity

            People

            • Assignee:
              grum [Mojang] Grum (Erik Broes)
              Reporter:
              marcono1234 [Mod] Marcono1234
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: