mojira.dev
MC-199530

Villager pathfinding broken

So I've been seeing villagers try to go somewhere and then they stop and turn around and end up being in a loop of going back and forth. This is most clearly seen at night time when the villagers try to find a bed (as seen in the video). Also, villagers will sometimes all try to go for one bed which ends up making there be like 5 villagers surrounding a bed.

 

EDIT: I've done the test without doors and realized it is 100% due to the doors. When I removed the doors the villagers went to the beds perfectly with no trouble. So, the real problem is villagers going to open doors to get to stuff.

Attachments

Comments 7

Please provide a screenshot of the village with the F3 debug screen enabled.

Heres a short video demonstrating a villager walking back and forth between two beds in a symmetrical testsetup.
https://youtu.be/XfWk72ctD8Q

It seems to be affected by which order the beds are placed in, the bed with the most positive X-coordinate needs to be placed before the one at the most negative X-coord. When done so, the villager will initially link up with the bed at the most negative X-coord (they seem to prefer this direction in a symmetrical setup, likely due to their POI scanning starting in this direction) and begin walking towards this bed, but as soon as it reaches the door and opens it, it will immediately change mind and begin waling towards the bed at the most positive X-coordinate. When it then reaches the second bed, it will change its mind again and walk back to the first bed.
Most often will this loop a couple of times before the villager finally goes to bed (as seen in the video) but sometimes it will also succeed in the first try. Rarely will it continue to loop between the two beds for an entire night and never get to sleep in any of the beds.
Doors seems to be linked to this in some way, since the removal of the doors in my test setup, precvents this behaviour entirely.

Also note, it can be difficult to test this since in some freshly created worlds, this behaviour never seems to occur.
Finally, I'm not able to replicate this behaviour in a testsetup along the Z-axis.

And a screenshot from above

[media]

I added a screenshot of a situation where villagers hesitate to get into their beds and also where villagers get stuck on doors.

[media]

To test it out, spawn in about 5 villagers

Added one more:

[media]

 

Also, this bug is weird in that it doesn't happen in every scenario and I can't really figure out what is causing it :/

Added a screenshot of the village with F3 on. All but one house has beds in them.

[media]

Java - Vanilla - 1.16.2

Possibly related:

2 villagers, one of each side of a door, will cause the door to not open. player attempting to open the door, will result in it instantly closing.

Villagers cannot interact with trapdoors, nor pathfind around them.

Does this issue still happen in 1.19.3? If yes, please update.

Adam Heaney

(Unassigned)

Unconfirmed

(Unassigned)

villager, villager-pathfinding, villager-sleeping

1.16.2, 1.18

Retrieved