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

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;
}
Fritz Meyer

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.

Paint

Relates to MC-13497.

CreeperMagnet_

Still affects 18w05a, please update!

CreeperMagnet_

Still affects 18w09a.

qwerty23495

Does this still affect the current snapshot 1.13-pre3?

pokechu22

It does.

Elemend

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

pokechu22

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.

Marián Kyral

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. 

numeritos

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

SunCat

Can't reproduce in 1.16.2

Avoma

I am also unable to reproduce this in 21w03a.

wobst.michael

@unknown is this still an issue for you in 21w03a or later?

Avoma

Also unable to reproduce in 21w05b.

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