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

"replace" directive in sounds.json does not work

XMLWordPrintable

    • Unconfirmed

      Read before closing: This ticket is related to MC-36348, but I do not think it is a duplicate. MC-36348 was poorly worded, and did not really focus on the issue with "replace". Furthermore, Grum could not reproduce the issue it described, and it was closed as "Cannot Reproduce". Players requested for it to be re-opened, but it never was.

      I'm making this ticket because I can unambiguously reproduce what I describe here. If you close this as a duplicate, please re-open MC-36348 and update its title, description, and Affected Versions. I wouldn't be doing this if the issue had a proper, open ticket.


      What I expected to happen:
      As described by Dinnerbone here, the "replace" property in a sounds.json event should cause it to completely replace the event of the same name, if set to true. Otherwise, it should merge together with the existing event.

      What actually happened:
      The "replace" property has no effect whatsoever. The game deserializes it, and the code seems like it should work, but it does absolutely nothing. Regardless of its value, events of the same name will always be merged with vanilla and other lower-precedence resource packs, making it impossible to remove sounds from an event.

      Among the consequences of this, it is impossible to have background music in music.game (survival overworld background music) without it also being transcluded to music.game.creative (creative background music).

      Steps to Reproduce:
      I've attached a simple resource pack exhibiting this bug. Its sounds.json (which is in the correct directory) contains the following:

      {
        "ambient.cave.cave": {
          "category": "ambient",
          "replace": true,
          "sounds": [
            "damage/fallbig"
          ]
        }
      }
      

      Steps:

      1. Enter the game, and select the "Sounds Replace Test.zip" resource pack.
      2. Make sure all of your volume sliders are on.
      3. Type the following command:
        /playsound ambient.cave.cave @a[r=20] ~ ~ ~ 2.5 1 1
      4. Observe that it plays either a random cave sound, or a crunching sound. The cave sounds are far more common than the crunching sound.
      5. Repeat until you have heard it enough times.
      6. Acknowledge that cave sounds should not be playing at all (and only the crunching should be playing), because the resource pack is meant to remove them.

      This issue applies whether or not the resource pack is zipped. The fact that a crunching sound sometimes plays indicates that the sounds.json is indeed read and the event is modified. The fact that the cave sounds still play indicate that despite the "replace" property, the event has been merged onto the underlying default event instead of replacing it.

            dinnerbone [Mojang] Nathan Adams
            wolfiemario WolfieMario
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: