mojira.dev
MC-189850

Animals seems to think they can find a path to unreachable places

What I expected to happen was...:

See the animals walk in the delimited area. 

What actually happened was...:

Instead, they seems to focus on the border of the enclosure

Steps to Reproduce:

  1. Create an enclosure with 1.5 height (A bloc and a slab) (Follow the images)

  2. Put cows inside

  3. Notice that the cows will focus on the borders (If they move, it's only to go to another one)

Linked issues

Attachments

Comments 5

As far as I understand, this might just be a side effect of the wandering AI. Blocks choose a random block to pathfind towards. Now, if they are in a pen, that block is more often than not outside of the pen, so they pathfind towards the edges of the pen.

This has been an issue for awhile.

The provided explanation is just that, an explanation of the bug. 
If that means the path-finding code is bad, and needs to be fixed, then such is the case.  Having all your animal group up on the walls of an enclosure should not be "normal" behavior. Otherwise why make a pen anything but 1 block wide just so you can heard a bunch of creatures in it. 

If I may suggest an idea, when picking the random block in the sphere, maybe divide this sphere blocks into two list of blocks, like "reachable in less than 10 blocks" and "not reachable" and maybe have a 10% chance to pick up a not available instead of an available ? I guess, change this rate according to the size of these two list could be a great idea too.

That way, it will give that feeling that entities sometimes wants to see what's outside the walls, but also make them live their lives inside the area they can walk in more naturally.

Though, I don't know the cost of the pathfinding algorithm and if you can set a limit on it (like 10 blocks). Absolutely not saying it's easy or I know better than the devs, just a proposal !

Most likely a duplicate of MC-12549.

Duplicate of MC-133370.

Jeremy T.

(Unassigned)

Unconfirmed

Mob behaviour

pathfinding

1.16 Pre-release 5, 1.16 Pre-release 6, 1.16 Pre-release 7, 1.16 Release Candidate 1, 1.16, 1.16.1

Retrieved