Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-241148

Named mobs hurt by water that die through a splash/lingering water bottle log death as "killed by magic"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 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
    • None
    • Confirmed
    • Debug
    • Low
    • Platform

      The bug

      Named mobs that are hurt by water that die through a splash water bottle log death as "killed by magic".

      To reproduce

      1. Summon a named water-sensitive mob (blaze, enderman, strider, etc.):
        /summon minecraft:blaze ~ ~ ~ {NoAI:1b,Health:1.0f,CustomName:'{"text":"MC-241148"}'}
      2. Throw a splash water bottle at it.
      3. 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);
                  }
              }
              ...
      

            Unassigned Unassigned
            ampolive [Mod] ampolive
            Votes:
            11 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: