The bug
Zombified piglins and wither skeleton avoid walking through fire or over magma blocks if there is an alternative (not much longer) path, even though these blocks aren't hazardous to them.
Note: In previous versions these mobs would never walk over these blocks, even if there was no alternative.
Exceptions
It appears under certain circumstances they do walk over these blocks, so make sure to avoid them when trying to reproduce the bug.
In general mobs apparently walk through fire and over magma blocks if this is the only available path.
Wither skeletons walk over magma blocks if there is only one, however when two are placed next to each other, they won't walk over them.
If the alternative path is much longer (or they are already in fire or on magma blocks?) they walk through fire / over magma blocks.
How to reproduce
See also:
Build a "U"-shaped two block wide magma block pattern in the floor
Switch to survival mode
Give yourself fire resistance (optional)
Summon one of the affected mobs
Run over the magma blocks
→ ❌ The mob walk around the magma blocks to reach you
Code analysis
See this comment
Linked issues
is duplicated by 2
relates to 2
Attachments
Comments 24
Can confirm. They indeed try to avoid fire, sometimes a Pigman decides to go through though.
@Bemoty
I think sometimes they get pushed in by other pigmen and once they are in they walk the rest of the way. But I've never seen one enter fire on it's own.

Take a look at the image from 16w14a and 16w15a, which shows the pathfinding debug renderer (not usable in normal gameplay, but documented here). You can see that the path has DANGER_FIRE
and DAMAGE_FIRE
indications on the fire, even though it's pigmen that are pathfinding. So, yes, the pathfinder definitely sees that there's fire and tries to avoid it, even though there's no real reason.
I checked the code, and it seems like blazes set the priority for both of those to 0 (normally it's 8 as you can just barely make out in the picture), meaning that their pathfinder is willing to enter them. The same thing could probably be done for pigmen and they would then happily run through fire.
@unknown I already checked the code for pathfinding and even got them to walk through fire by returning PathNodeType.WALKABLE
for EVERY mob when they see fire in the method net.minecraft.pathfinding.WalkNodeProcessor.getPathNodeTypeRaw()
. I didn't realize that mobs could have different danger/pathfindig-priorities. Not 100% familiar with Minecraft's code, yet. 😛
Thanks! Also, that debug path plugin channel is super cool! Didn't know something like that existed.
Yep! This bug can be fixed by setting the path priority for both DAMAGE_FIRE
and DANGER_FIRE
and maybe LAVA
to 0.0F. Setting the path priority can be done by using the method setPathPriority
. After that, Zombie Pigmen will also run through fire to kill you if you are mean to them.
net.minecraft.entity.monster.EntityPigZombie
public EntityPigZombie(World worldIn)
{
super(worldIn);
this.setPathPriority(PathNodeType.DANGER_FIRE, 0.0F);
this.setPathPriority(PathNodeType.DAMAGE_FIRE, 0.0F);
this.isImmuneToFire = true;
}
I'm still able to reproduce this in 21w05b. Same behaviour as here
[media]and here
[media]
I think they want to avoid lava too. A wither skeleton won't pathfind to me through lava and just flips its arms up and down at me.

Affects 1.19.4-pre4.

Affects 1.20.4

Confirmed in 1.21.3
Just noticed that they are also avoiding magma blocks.