-
Bug
-
Resolution: Fixed
-
1.18.2, 1.20.1, 1.20.2
-
Confirmed
-
Advancements
-
Low
-
Platform
When a player takes damage from a DamageSource of ANVIL, FALLING_BLOCK, or FALLING_STALACTITE, if the player is wearing head gear, there will be a difference between the actual damage taken by the player and the damage seen in Advancement criteria.
Code analysis
net.minecraft.world.entity.LivingEntity
public abstract class LivingEntity extends Entity { ... public boolean hurt(DamageSource damageSource, float f) { ... if ((float)this.invulnerableTime > 10.0f) { ... this.actuallyHurt(damageSource, f - this.lastHurt); ... } else { ... this.actuallyHurt(damageSource, f); ... } if (damageSource.isDamageHelmet() && !this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { ... f *= 0.75f; } ... if (this instanceof ServerPlayer) { CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer)this, damageSource, f2, f, bl2); ... } } }
The difference occurs because the variable f is multiplied by 0.75f after LivingEntity#actuallyHurt.
- relates to
-
MC-251027 Wearing a helmet doesn't reduce the damage of falling anvils or stalactites by 1⁄4
- Resolved