mojira.dev
MC-248707

Hostile mobs targeting an entity they cannot pathfind to or have just attacked will repeatedly look at the entity, then away

Closely relates to MC-87093, however a "tracking" animation is not necessarily present; zombies do not show the arm animation problem from that ticket yet still exhibit this other behaviour. I cannot find any other tickets that describe this behaviour after searching.

The bug

When a hostile mob has line of sight to an entity they are targeting but is physically incapable of reaching them, they will repeatedly turn to face the entity and then back to the direction they were originally facing.

How to reproduce

A setup is shown in the attached screenshots featuring the player standing on a block as to be one block higher than the mob, which is trapped in a hole that allows them to see but not escape. Standing on the block should highlight the behaviour.

Expected results

The mob should either act normally as if no player is present, or continuously stare at the player they're interested in.

Actual results

The mobs appear to switch between acting normally and attempting to reach the player, causing them to nod strangely.

Related issues

Attachments

Comments

migrated
[media][media][media][media][media][media][media][media][media][media][media]
Moesh

These screenshots do not show the issue. Please attach a video.

muzikbike

Video should be attached. Here's a youtube link in the event that it can't be played: https://youtu.be/q30lkcwE6FM

Moesh

Thank you. Edited the title to remove "turn away" as it made it seem like the mob was spinning in place.

Avoma

Can confirm in 1.18.2. It's important to note that this issue can be seen when hostile mobs target any entity and not just the player.

[media]
chumbanotz

I think this is related to my comment on MC-198068, but to summarize, the AI that controls them looking at their target is the same class that makes them pathfind to and attack their target, which keeps starting and resetting when they cannot find a path to the target, thus causing the mobs to briefly look at and away from the target.

migrated

This bug title is inaccurate, as even when Zombies can pathfind to you and are continuosly attacking you, they still constantly turn away and then look at the player again

I guess it all comes down to an issue with the pathfinding

Avoma

Can confirm in 1.19.

Avoma

Can confirm in 1.19.2 and 22w42a.

migrated

In 1.20

migrated

In 1.20.1 and 23w32a

muzikbike

(Unassigned)

Confirmed

Platform

Low

Mob behaviour

pathfinding

1.18.2 Pre-release 1, 1.18.2, 22w15a, 22w16b, 1.19 Pre-release 3, ..., 22w42a, 1.20, 23w35a, 1.20.5 Pre-Release 1, 24w33a

Retrieved