The bug
Named mobs that are hurt by water that die through a splash water bottle log death as "killed by magic".
To reproduce
Summon a named water-sensitive mob (blaze, enderman, strider, etc.):
/summon minecraft:blaze ~ ~ ~ {NoAI:1b,Health:1.0f,CustomName:'{"text":"MC-241148"}'}
Throw a splash water bottle at it.
Look at the logs.
Observed result
Log says "MC-241148
was killed by <Player/Potion> using magic".
Expected result
Log uses an appropriate death message, or at least wouldn't mention "using magic", as there is no potion, just a water bottle.
Code analysis
In ThrownPotion#applyWater()
, the DamageSource
is "indirectMagic"
:
net.minecraft.world.entity.projectile.ThrownPotion.java (22w11a, Mojang mappings)
AABB $$0 = this.getBoundingBox().inflate(4.0, 2.0, 4.0);
List<LivingEntity> $$1 = this.level.getEntitiesOfClass(LivingEntity.class, $$0, WATER_SENSITIVE);
if (!$$1.isEmpty()) {
for (LivingEntity $$2 : $$1) {
double $$3 = this.distanceToSqr($$2);
if (!($$3 < 16.0) || !$$2.isSensitiveToWater()) continue;
$$2.hurt(DamageSource.indirectMagic(this, this.getOwner()), 1.0f);
}
}
...
Relates to MC-230878.