I notice this bug initially from a realm I was playing in. I thought it was intentional but it got really annoying because the Wandering Trader's Llamas always kept getting in the way. I then went over to my barn and noticed how all of my horses had this exact same behaviour when strapped to a fence. I then went over to a separate world and tried to replicate the issue and to my surprise, it happens to any mob that can be leashed as soon as they begin to walk out of bounds from the lead. Then it would walk to the player/entity/post but then would begin to walk again in the same direction, causing an infinite loop.
What I expected to happen was:
The mob would return to the player/entity/post and then pause for any further movement from the player/entity to continue to follow. Then it would try to walk within the lead's boundaries.
What actually happened was:
The mob would return to the player/entity/post as intended, but would then continue on its original path despite the fact the mob can't reach its destination.
Steps to Reproduce:
First get an entity that can be equipped with a lead (preferably a llama for the sake of the demo).
Then either wait for the mob to move out of bounds, (when the lead begins to stretch) or attach it to a fence.
Observe it's behaviour when it walks. (Give it time, it can take a while)
Files: https://drive.google.com/file/d/1-VwdN7Vr_6YCE-y8yhPxaIwQrTwA2ZgJ/view?usp=sharing
Linked issues
is duplicated by 2
Attachments
Comments 5
UPDATE: After further testing on 1.16 BETA I have noticed a new behaviour that causes mobs no longer stop walking/pushing to reach the player when the player holds onto the leads or when the Wandering Trader's Lammas has reached a certain distance away that they're forced to walk back to the Trader. Even though the mobs are already close enough to the player/Trader that they should stop, they continue walking causing endless pushing until you unleash them.
I triple checked 1.16.0.66 and 1.16.0.64 due to changes made to mobs path-finding mentioned in the changelog. It is confirmed by my testing that this bug is still in effect.
Duplicate report MCPE-62094 shared this video from 1.14.1:
https://bugs.mojang.com/secure/attachment/261871/Minecraft_2020-01-14-20-45-51_001_001.mp4
On Java Edition leashed mobs do not pathfind at all, they just stand still. That makes a lot more sense, and should be easy to implement.
This could be done with a behavior pack by changing every leashable mob's behavior in the following way:
Put the behavior.random_stroll inside a component group instead of in the base components.
Set up environment sensors to trigger events adding the component group whenever the mob is not leashed and removing it whenever the mob is leashed.
Much simpler would be a hard-coded change to make the random_stroll behavior conditional on not being leashed.
UPDATE: So I figured out why the AI loops on pathfinding. I'm going to try my best to explain this, then show a video on how it works.
So basically when a mob chooses a destination to walk towards it has a goal and a specific timer or Alarm that runs to make sure the mob does not hog up performance endlessly walking with no end in sight to get to the goal. This is what is happening here. Basically, because I have a lead, it prevents the mob from getting to its destination. But because no alarm exists to stop the mob from endlessly pressing to reach its goal, it will keep going and going forever.
Here is an example: https://drive.google.com/file/d/1RwtzcihcNNgqjK-0LFp5qqbSU2thwwYt/view?usp=sharing
What you are observing here is a horse trying to reach a patch of grass to eat in the distance, but it has to go through me first. However, when the horse will try to push me, you'll see how its AI will endlessly continue to do this without stopping. After 1 Minute (which is more than enough time a horse is supposed to have to reach its goal), I moved and let it get there. Then to confirm my theory, I got in front of the horse again only to see it do the exact same thing. I then cut off the video to see how long it would do this. (Spoilers): After 43 Minutes of just sitting in my chair it was still..... going.....
TL;DR: There is no Alarm/Timer to stop the AI from reaching its destination.
Here's proof: https://drive.google.com/file/d/1RwtzcihcNNgqjK-0LFp5qqbSU2thwwYt/view?usp=sharing
This behaviour went on even after 43 Minutes.