mojira.dev
MC-120010

Zombified piglin and wither skeleton avoid walking through fire or over magma blocks

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:

[media]
[media]
  1. Build a "U"-shaped two block wide magma block pattern in the floor

  2. Switch to survival mode

  3. Give yourself fire resistance (optional)

  4. Summon one of the affected mobs

  5. Run over the magma blocks
    → ❌ The mob walk around the magma blocks to reach you

Code analysis

See this comment

Linked issues

Attachments

Comments 24

Fritz Meyer

Just noticed that they are also avoiding magma blocks.

bemoty

Can confirm. They indeed try to avoid fire, sometimes a Pigman decides to go through though.

Fritz Meyer

@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.

pokechu22

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.

bemoty

@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;
}
14 more comments
violine1101

I'm still able to reproduce this in 21w05b. Same behaviour as here

[media]

and here

[media]
Brevort

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.

Brevort

Affects 1.19.4-pre4.

0x06

Affects 1.20.4

Minecraft386882

Confirmed in 1.21.3

Fritz Meyer

(Unassigned)

Confirmed

Gameplay

Normal

Mob behaviour

ai, fire, wither_skeleton

Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2 Pre-Release 2, Minecraft 1.12.2, ..., 21w05b, 1.19.2, 23w06a, 1.19.4 Pre-release 4, 1.21.3

Retrieved