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

/playsound range check prevents higher attenuation distance sounds from working correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.2, 1.19.3, 1.19.4, 1.20.1, 1.20.2, 23w43b
    • None
    • Confirmed
    • Commands, Sound
    • Low
    • Platform

      In sounds.json, sounds can have an attenuation distance set. This defaults to 16, which is the same as /playsound range.
      When set lower, it works properly, ending the sound sooner than 16 blocks.
      When set higher, it has no affect because the command fails, unless you use a higher volume (which causes MC-255436), in which case attenuation distance gets multiplied by the volume, making values over 16 useless.

      Steps to reproduce:
      (block.conduit.ambient has an attenuation distance of 8, entity.fox.screech has one of 32)

      1. use /playsound block.conduit.ambient master @s ~ ~ ~7 1
      2. Observe a near-silent sound
      3. use /playsound block.conduit.ambient master @s ~ ~ ~9 1
      4. Observe no sound
      5. use /playsound entity.fox.screech master @s ~ ~ ~17 1
      6. Observe the error message from the command, despite attenuation distance set to beyond 17 blocks.
      7. use /playsound entity.fox.screech master @s ~ ~ ~1799 1000
      8. Observe it can still be heard, despite being outside of attenuation distance
      9. use /playsound block.conduit.ambient master @s ~ ~ ~400 1000
      10. Observe it can be heard despite being well outside of attenuation distance

      Expected result:
      The sound event request gets send to the client, and the client determines if it's within attenuation distance.

      Actual result:
      The server never sends the request.

      The fix is as simple as removing the range check from the command, and letting the client handle it.

      Side note:
      When fixing this, it might be a good idea to add an option so sounds can be heard everywhere (eg attenuation distance being 0, or negative), as currently when map makers wish to play music, they just play it at an insanely large volume.

            Unassigned Unassigned
            jirauser71590 user-f2760 (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: