Named mobs hurt by water that die through a splash/lingering water bottle log death as "killed by magic"
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":
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);
}
}
...
2021-11-11, 01:50 PM
2024-07-05, 12:43 AM
11
2
21w44a - 1.21
21w44a, 1.18 Pre-release 1, 1.18 Pre-release 2, 1.18 Pre-release 5, 1.18 Pre-release 6, 1.18 Pre-release 8, 1.18 Release Candidate 3, 1.18.1 Release Candidate 1, 1.18.1 Release Candidate 2, 1.18.1, 22w03a, 22w05a, 22w07a, 1.18.2, 22w11a, 22w12a, 22w15a, 22w19a, 1.19 Pre-release 1, 22w24a, 1.19.1 Pre-release 5, 1.19.1 Release Candidate 2, 22w43a, 1.19.3, 23w04a, 1.20 Pre-release 4, 1.20.1, 1.20.4, 1.21
-