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

Playsound - minimumVolume not working as expected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.6.4, Minecraft 13w43a, Minecraft 15w51b, Minecraft 16w02a, Minecraft 16w33a, Minecraft 1.12.2, Minecraft 17w45b, Minecraft 18w03b, Minecraft 18w08b, Minecraft 1.13.1, Minecraft 19w09a
    • Fix Version/s: Minecraft 16w35a
    • Environment:

      Windows 10 Home (64 Bit)
      Java Version 8 Update 6 (1.8.0_60-b27)

    • Confirmation Status:
      Community Consensus
    • Category:
      Commands, Sound

      Description

      The /playsound parameter minimumVolume is not exactly a minimum volume but rather a default volume.
      Basically, if the player is out of reach, the sounds origin is centered at the player instead of the entered coordinates.
      However if the player moves away from the new position while the sound is still playing, volume will decrease as if it was played at the player's previous location without the minimumVolume parameter.
      Therefore it is impossible to play a sound globally because even with a minumumVolume of 1 the volume will decrease as the player moves.

      Example:
      /playsound minecraft:entity.enderdragon.death hostile @a ~ ~ ~ 1
      Sound is played at the current location with maximum volume (as expected)

      /playsound minecraft:entity.enderdragon.death hostile @a ~17 ~ ~ 1
      Player is out of range, sound isn't played at all (as expected)

      /playsound minecraft:entity.enderdragon.death hostile @a ~ ~ ~ 1 1 1
      Sound is played at the current location with maximum volume, but volume decreases if the player moves (not as expected)

      /playsound minecraft:entity.enderdragon.death hostile @a ~15 ~ ~ 1 1 1
      Sound is played at the specified location with maximum volume, but at the players location it's barely hearable
      -> (volume < minimumVolume) (not as expected)

      /playsound minecraft:entity.enderdragon.death hostile @a ~17 ~ ~ 1 1 1
      Player is out of range, sound gets centered at the current location with maximum volume (not as expected)

      Solution
      The problem is not as simple as I first thought.
      The minimumVolume parameter is processed only by the server and never actually sent to the client, so in order to resolve this issue the network protocol would have to be altered.
      Instead of simply repositioning the source the client needs to know that the sound is meant to be played with a global minimum volume.

      Btw, you are calculating the distance between the audio source and the player twice; once via EntityPlayerMP.getDistance() and once manually (net.minecraft.command.CommandPlaySound.processCommand()).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Mario Welzig Mario Welzig
              • Votes:
                15 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: