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
relates to
Attachments
Comments
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 changed the title and description to reflect that the same thing happens with magma blocks, which I hadn't yet found at time of creation. It seems to be the same bug that can be fixed in the same way, by setting the danger priority to 0, so it seems a good idea to have them listed in the same issue.
Relates to MC-13497.

Still affects 18w05a, please update!

Still affects 18w09a.

Does this still affect the current snapshot 1.13-pre3?

It does.
In 18w31a they will walk over magma blocks and also through fire to chase the player, tested in 18w31a. Fixed, maybe?

I've been testing like with
[media], instead of an open area and that still occurs; they don't seem willing to go through if there isn't any other path. They might detect it as a valid optimization if other paths do exist, though; I haven't tested it much.
I'm testing a small Zombie Pigman farm in Crimson Forest. The floor is made from magma blocks to avoid piglin spawn. In the middle is a turtle egg. Zombie Pigman spawn, but stay still, don't want destroy the egg.

Cannot reproduce in 20w30a, zombified piglin walks through magma as another block

Can't reproduce in 1.16.2
I am also unable to reproduce this in 21w03a.

@unknown is this still an issue for you in 21w03a or later?
Also unable to reproduce in 21w05b.
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.