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

Mobs can panic in situations where they receive no damage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 1.19, 22w24a, 1.19.1 Pre-release 1, 1.19.1 Pre-release 2
    • None
    • Confirmed
    • (Unassigned)

      The Bug:

      Mobs can panic in situations where they receive no damage.

      For example, when a mob is on fire and has the fire resistance effect, it will continuously panic even though it doesn't receive any damage. This same concept can be seen when a mob enters but isn't damaged by powder snow.

      Steps to Reproduce:

      • Summon a cow with the fire resistance effect that's on fire.
      • /summon minecraft:cow ~ ~ ~ {Fire:999s,ActiveEffects:[{Id:12,Amplifier:1,Duration:999999}]}
      • Observe the behavior of the cow closely.
      • Take note as to whether or not mobs can panic in situations where they receive no damage.

      Observed Behavior:

      Mobs can panic in situations where they receive no damage.

      Expected Behavior:

      Mobs would only panic when receiving damage.

      Code Analysis:

      Code analysis by Avoma can be found below.

      The following is based on a decompiled version of Minecraft 22w24a using Mojang mappings.

      net.minecraft.world.entity.ai.goal.PanicGoal.java
      public class PanicGoal extends Goal {
         ...
         protected boolean shouldPanic() {
            return this.mob.getLastHurtByMob() != null || this.mob.isFreezing() || this.mob.isOnFire();
         }
         ...

      If we look at the above class, we can see that a mob will begin panicking when hurt by a mob, is freezing, or is on fire. The problem here is that the shouldPanic() boolean doesn't check if the mob received damage from freezing or fire, and instead only checks if the mob is freezing or is on fire, resulting in this problem occurring.

        1. MC-253327.mp4
          5.65 MB
        2. MC-253327.png
          MC-253327.png
          1.02 MB

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: