-
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.
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.
- relates to
-
MC-253209 Some mobs will no longer panic when receiving poison/wither damage
- Resolved