-
Bug
-
Resolution: Unresolved
-
None
-
1.17, 1.17.1 Pre-release 2, 21w43a, 1.18 Pre-release 4, 1.18.2, 22w12a, 22w14a, 22w15a, 22w17a, 1.19 Pre-release 2, 1.19, 1.19.1 Pre-release 6, 1.19.1, 1.19.2, 22w42a, 22w43a, 22w44a, 22w46a, 1.19.3 Pre-release 1, 1.19.3, 23w03a, 1.19.4 Pre-release 1, 1.19.4, 23w16a, 23w18a, 1.20 Pre-release 1, 1.20 Pre-release 2, 1.20 Pre-release 5, 1.20 Pre-release 6, 1.20, 1.20.1, 23w32a, 23w35a, 1.20.2 Pre-release 1, 1.20.2 Release Candidate 1, 1.20.2, 23w41a, 23w42a, 23w43a, 23w44a, 1.20.3 Pre-Release 2, 1.20.3, 1.20.4, 24w07a, 24w09a, 24w10a, 24w12a
-
None
-
Community Consensus
-
Debug, Text
When a villager falls from a high place, the death message logged is "Villager hit the ground too hard", maybe followed by "whilst trying to escape <player/mob>" if someone knocks him from a high place. This is the case even for climbable blocks. Named mob deaths which are now logged in 1.17.1 Pre-release 2 use "fell from a high place", "fell off a ladder" and so on.
How to reproduce:
- In the launcher, go to the settings and enable "Open output log when Minecraft: Java Edition starts".
- Launch any version above release 1.15.
- Enter a singleplayer world.
- Punch a villager off a platform 25 blocks high up in the air.
- Look at the log.
What I expected to happen was:
The villager's death message would contain the cause of its fall damage ("fell from a high place" or "fell off a ladder" or others like these).
What actually happened was:
The villager's death message was either "hit the ground too hard" or "hit the ground too hard whilst trying to escape <player/mob>".
Cause:
When a villager dies, Villager#die is run for that villager. That method is shown below.
public void die(DamageSource damageSource) { LOGGER.info("Villager {} died, message: '{}'", this, damageSource.getLocalizedDeathMessage(this).getString()); Entity entity = damageSource.getEntity(); if (entity != null) { this.tellWitnessesThatIWasMurdered(entity); } this.releaseAllPois(); super.die(damageSource); }
At the start of the method, a message with two arguments (pairs of curly braces) is printed to the console. The first argument is replaced by Villager#toString, while the second argument is replaced by damageSource.getLocalizedDeathMessage(this).getString(). This doesn't allow for the villager's CombatTracker to check for climbable blocks, and thus death messages for climbable blocks cannot appear. Named entities use this.getCombatTracker().getDeathMessage().getString() for the second argument instead, and this is what should be used for villagers as well.