This bug has been around for so long I've just accepted it as a fact of Minecraft life, but since Mojang is trying to polish survival gameplay in 1.9, I think they should take a look at this. Basically, when a mob is killed, any sounds it was making previously keep playing, which is a bit disorienting in the cases of Creepers and Endermen. Most of the time I'm not able to kill a creeper in melee without triggering its hiss sound when it dies, and since the sound is centered at a position in the world, if I run past the dying Creeper as it hisses it sounds like there's another one behind me about to explode. As for Endermen, their aggro sound is really long-lasting, and if you kill one in just a few hits it sounds like they're still coming for you. What I'd like to see is for all of a mob's sounds except for its death sound to immediately stop playing if the mob is killed.
I imagine fixing this issue will involve giving all sound events some sort of "source" tag to track the entity (if any) which played the sound originally. Ideally /playsound would also be updated to accept an additional, optional boolean (false by default) for deciding whether to tie the sound to the executor.
Linked issues
is duplicated by 8
Comments 11
It should be rather easy to fix, if (mob =! Dead) playsound, else do nothing
I don't know exactly how to code works, but that wouldn't be a super hard fix
I think that he is saying that the sounds do not stop after the mobs die.
if (mob =! Dead) playsound
will not fix this then.
yeah, you're right, but it can also cancle playing any sound but the death sound in the code. Fore example music already does this (doesn't play in the snapshots, but that's a diffrent bug), when creative mode music plays, and you switch gamemode, it stops playing the music, so the same could go for the mobs, if it's dead, it could stop playing the sounds
Yes, but normal sounds aren't supported. The pausable sounds are "stream: true" according to the sounds.json file. If the stream parameter is true, it is pausable.
Minecrafts sound system allows any sound to be paused and stopped regardless of the stream parameter (just open the ingame menu and any sound will be paused). The difficulty in implementing your suggestion is that once played, the actual sound object is no longer tied to the causing entity in any way other than the playing position, however the entity may have moved since the sound started. So basically it is currently impossible to decide, which sounds should be stopped when the entity dies.
Should be an easy fix because /stopsound is already a thing. Unless there is no way to track what entity a sound came from.
Isn't it possible to use the system that prevents new mob sounds from playing to break of already playing sounds? So, that if there are no more charging up creepers, that the hissing sound is immeadiatly broke of?
The new Breeze mob has a sound handler where the sound updates its location as the entity moves and is canceled when the entity is removed. This seems like a great step forward and shows that such issues are now fixable. It might be worth reconsidering this for mobs like the Enderman and the Creeper, as it could significantly improve the gameplay experience.
Unable to fix due to how sounds work. Probably.