-
Bug
-
Resolution: Works As Intended
-
None
-
1.17.1, 21w43a, 21w44a, 1.18 Pre-release 1, 1.18 Pre-release 2, 1.18 Pre-release 5, 1.18 Pre-release 7, 1.18 Pre-release 8, 1.18 Release Candidate 3, 1.18, 1.18.1 Release Candidate 1, 1.18.1, 22w03a, 22w05a, 22w07a, 1.18.2, 22w11a, 22w12a, 22w15a, 22w17a, 22w18a, 1.19 Pre-release 1, 1.19 Pre-release 3, 1.19, 1.19.1 Pre-release 5, 1.19.2, 1.19.3, 23w03a, 1.19.4, 23w14a, 1.20 Release Candidate 1, 1.20
-
Confirmed
-
Sound
The bug
Dying entities can still make splashing/falling sounds, as if they were still alive. This could be intended.
To reproduce
- Create a new creative world and fly a few blocks above water/land.
- Execute the following command:
/summon turtle ~ ~ ~ {Health:0}
Observed result
The mob makes sounds after dying.
Expected result
The mob would not make sounds after dying.
Code analysis
Using Mojang mappings (22w11a).
LivingEntity#causeFallDamage(...) does not check if the entity is alive in order to play the fall sounds:
... @Override public boolean causeFallDamage(float $$0, float $$1, DamageSource $$2) { boolean $$3 = super.causeFallDamage($$0, $$1, $$2); int $$4 = this.calculateFallDamage($$0, $$1); if ($$4 > 0) { this.playSound(this.getFallDamageSound($$4), 1.0f, 1.0f); this.playBlockFallSound(); this.hurt($$2, (float)$$4); return true; } return $$3; } ...
A potential fix would be to replace if ($$4 > 0) with if ($$4 > 0 && this.isAlive()).