Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-170016

Villager can't pathfind towards objectives in a floor above it if path is "longer than expected"


    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • 1.15.1, 1.16 Release Candidate 1, 1.16, 1.16.5, 21w19a, 1.17.1
    • None
    • Windows 10 Desktop, Java 8 Update 251 (64 bit)
    • Unconfirmed
    • (Unassigned)

      After building a structure with multiple floors, i decided to populate it with villagers. This "village" is structured in this way: the ground floor has job site blocks while the first floor above has rooms with beds, like a condominium.

      At first it looked like it was working as intended but then i noticed villagers started "acting wild": it happened when the villager's position in the ground floor tried to reach a bed right above him but even with a path up there avaiable, the villager wouldn't take the avaiable path and would get right below the bed instead. Only if there were few blocks away from the bed then the villager would reach the bed. Same happens viceversa, if villager is above and job site is right below.

      If i got it right, pathfinding for villagers (or mobs in general?) gets wild when the villagers try to reach higher objectives and the path towards the latter is longer than expected by the AI's pathfinder: in this case, it's a villager "seeing" a bed above him and "trying" to reach it from below in order to "not take the longer path" but not succeeding. More technically, the pathfinder "prefers" the shorter path (that doesn't exist because there is no way to go up) because it can't detect the longer one.

      This was a bummer for me because i really expected villagers taking the stairway towards their objectives instead of seeing them hanging over the area where the bed is placed right above. Is there a way to fix this problem, and thus making "multiplane" pathfinding more functional?

      Attachments are uploaded, showing how the villager behaves when he detects a bed nearby but the path to the bed avaiable is long.

      (irrelevant info for visitors but i feel like i need to point it out: i made the "end gateway" there, was messing with command block teleportations).

        1. 2 - villager now can reach bed.png
          2 - villager now can reach bed.png
          1.18 MB
        2. 4 - villager reached bed.png
          4 - villager reached bed.png
          1.83 MB
        3. 1 - villager can't reach bed.png
          1 - villager can't reach bed.png
          1.88 MB
        4. 3 - villager going up.png
          3 - villager going up.png
          2.06 MB
        5. villager_issue.zip
          8.86 MB

            Unassigned Unassigned
            SaturnoCane92 Alessio Saturno
            3 Vote for this issue
            4 Start watching this issue