The bug
The /playsound
parameter minVolume
is not exactly a minimum volume but rather a default volume.
Basically, if the player is out of range, the sound's 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, the volume will decrease as if it were played at the player's previous location without the minVolume
parameter.
Therefore it is impossible to play a sound globally because even with a minVolume
of 1 the volume will decrease as the player moves.
How to reproduce
/playsound minecraft:entity.ender_dragon.growl hostile @a ~ ~ ~ 1
→ ✔ Sound is played at the current location with maximum volume
/playsound minecraft:entity.ender_dragon.growl hostile @a ~17 ~ ~ 1
→ ✔ Player is out of range, sound isn't played at all
/playsound minecraft:entity.ender_dragon.growl hostile @a ~ ~ ~ 1 1 1
→ ❌ Sound is played at the current location with maximum volume, but volume decreases if the player moves
/playsound minecraft:entity.ender_dragon.growl 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 < minVolume
)
/playsound minecraft:entity.ender_dragon.growl hostile @a ~17 ~ ~ 1 1 1
→ ❌ Player is out of range, sound gets centered at the current location with maximum volume
Solution
The problem is not as simple as I first thought.
The minVolume
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()
).
Linked issues
is duplicated by 4
Comments 25
I too have noticed this. It makes it impossible to have a sound be played globally which is required for fx background music in adventure maps.
Is this still a concern in the current Minecraft version 14w10c / Launcher version 1.3.10 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.
Is this still a concern in the current Minecraft version 14w18b / Launcher version 1.3.11 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.
This ticket is incomplete without the requested information, no response has been received within a reasonable time and we are assuming the issue has been resolved. If you are still experiencing this issue, we can reopen it at your request.
Please review the guidelines before reporting issues.
I have noticed that to. and i don't know why.