Steps to Reproduce:
1. Open up a world and run
/summon minecraft:warden ~ ~ ~ {Health:0f,DeathTime:-200s}
Command courtesy of @unknown
Original Description:
If you were to kill a warden, its heartbeat still continues to happen even in the death animation.
To replicate this, pay attention to the frequency of the warden's heartbeat and time it so the next one would align to killing it and being in its death animation. You will see that it will continue to beat even during the death animation and can be confirmed further by turning subtitles on. This way you can see the "Warden's Heart Beats" plays after "Warden Dies" as well as seeing that the warden's heart visually beat on its chest during death animation.
Attachments
Comments 3
I can also confirm this behavior in 1.19.2. Here's a code analysis regarding this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.19.2 using Mojang mappings.
net.minecraft.world.entity.monster.warden.Warden.java
public class Warden extends Monster implements VibrationListener.VibrationListenerConfig {
...
@Override
public void tick() {
...
if (this.level.isClientSide()) {
if (this.tickCount % this.getHeartBeatDelay() == 0) {
this.heartAnimation = 10;
if (!this.isSilent()) {
this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.WARDEN_HEARTBEAT, this.getSoundSource(), 5.0f, this.getVoicePitch(), false);
}
}
...
If we look at the above class, we can see that there is only one check carried out before the WARDEN_HEARTBEAT
sound event can be played. This check is to see if the warden has their "Silent" tag set to "1b", and if so, no sound will be played. No checks are carried out to see if the warden is currently dying, therefore resulting in the heartbeat sound being able to play during its death animation.
Potential Fix:
Adding an additional check to see if the warden is currently in the process of dying before allowing the WARDEN_HEARTBEAT
sound event to be played should resolve this problem. This could be achieved by calling the isDeadOrDying()
method where appropriate within this piece of code.
The following "if" statement:
if (!this.isSilent()) {
could be changed to the following in order to resolve this problem:
if (!this.isSilent() && !this.isDeadOrDying()) {
I can confirm this behavior. As a super easy and straightforward method of replicating this, simply execute the command provided below and listen closely.
[media]