I will say right now that both MC-12427 and MC-4661 are included in what I am about to report. However, I am reporting exactly what the problem is, how they are in reality the same issue, examples of other pathfinding issues which also occur, and how it could all be fixed with a single theoretical solution. It seems sort of conceded to ask if they could be consolidated into this report, but I feel like this single one is more constructive than a bunch of little ones out there which are all symptoms of the same bug.
The problem
The problem with the pathfinding in Minecraft is that is uses a strictly grid-based system. This would be okay except that collisions are not as strictly grid-based. Entity movement accounts for this, but pathfinding does not. The consequences of this are far reaching. Basically there are many ways in which an entity may conclude that it cannot move when in reality it can and vice versa. Fixing this bug would make farming less frustrating and hiding from monsters much harder. Let me explain each of the four images inside the larger image I posted.
1. Mobs (the creeper) get stuck in northwest corners
This is a combination of things. For one thing, entities begin pathfinding from their northwest corner instead of their center. For another, they do not take into account collisions properly. This means the creeper pictured begins his pathfinding from inside the corner fence. This creeper believes he can travel both north and west because it is air, and he cannot travel either south or east because they are fences. All four of these assertions are wrong. If he were to analyze collisions instead of just the grid he would know this.
2. Mobs are incapable of passing through half slab gaps
Some people like and utilize this, but it is a flaw. The creeper knows he can pathfind through the center of the hole, but reasons he is too tall to put his feet through the center and his head through the half slab. This is false. He does not take into account where his feet will land, and the same can be said about his head.
3. Mobs, especially small ones, get stuck inside walls
The picture is a special case in which the sheep has his northwest corner inside a wall. He can clearly step back and walk through the opening in the fence to my character, but he believes the fastest way is to walk through, because he is already "inside" the fence and does not take collisions into account. This same thing will happen with small entities far more frequently because their entire collision box can fit inside the fence block. This makes it a pain to lead animals along/through fences and other thin walls.
4. Mobs cannot navigate through gaps between blocks
This is the same issue as the creeper who cannot walk through the half slabs but in the x and z dimensions. If the chicken were to acknowledge the size of its bounding box and which blocks it would collide with, it could reason that it is possible to fit through the gap.
More details
It has recently come to my attention that small entities like chickens cannot pathfind out of fence corners even if they are told they can pathfind literally anywhere. This is because they cannot draw a vector out of the fence wireframe without concluding they will collide with it.
Theoretical solution
Ideally, if the code could be more double-based, relying on the actual bounding box, this problem would be fixed in all instances. But, unfortunately, that would likely require a significant amount of processing. Instead, it is probably best to add more conditions to the code which allow pathing along but not through fences.
At the very least, changing pathfinding so that entities begin from their center should fix situations 1 and 3 (MC-12427 and MC-4661 respectively) for the majority of creatures (everything but babies, silverfish, and chickens).
Related issues
is duplicated by
relates to
Attachments
Comments


PLEASE.
Thank you for explaining – and showing with simple pictures – exactly what's going on.
PLEASE, Mojang, this and 2025 – please make these, and similar issues, the focus of your next patch level. Yes, I'm asking for 1.7 to be the raid release (raid = bug spray)

Can confirm.

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

I tested this bug in Creative Singleplayer also and can confirm it still exists in 1.6.2.

Do you have any idea what the computational cost of pathfinding is? A lot of games pre-calculate and store pathing information for the terrain in order to reduce the cost of finding a path. There are certainly improvements that could be made, particularly to solve the sort of problems you mention, but you're oversimplifying the problem a great deal.

@Torabi
No, I have no prior knowledge of the computational cost of pathfinding, but I do have a decent guess. And I do understand the challenges of pathfinding in a dynamic environment.
I do think I oversimplified the theoretical solution. Having read the pathfinding code thoroughly now, I am disappointed to say that I doubt it can function perfectly ever. Changing it from int based to double based would require exponentially more points, memory, etc. I think the only way the problem has any chance of being solved in a remotely optimal way is by continually adding even more conditions to the code that basically say "in this very specific situation, do this".

Is this still a concern in the current Minecraft version 1.7.2 / Launcher version 1.3.4 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Yes, this affects all versions up to the most recent snapshot, 13w48b. This bug would require a very significant code change to fix.

Is this still a concern in the current Minecraft version 1.7.4 / Launcher version 1.3.8 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

This affects all versions up to snapshot 14w03b.

I can confirm in 14w08a with the stuck in NW corner part

Is this still a concern in the current Minecraft version 14w18a / Launcher version 1.3.11 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

There has been no rewrite of the pathfinding system. I can still observe this issue in 14w18b.

This happens with silverfish, cave spiders and endermites as of snapshot 14w21b.

I may be experiencing something similar to this in 14w snapshots (21b,25a,25b). I have two snow golems (which are NBT tagged to be invincible). They WERE attacking a baby Zombie with snowballs, so I named the baby so it wouldn't despawn. This all was happening near a corner of Nether brick fence, and somehow the little Zombie was pushed into the corner. The Zombie does not move (and being a baby it is immune to sunlight) and the golems aren't throwing stuff at it. This may be a result of how small baby Zombies are, because they can fit entirely into the hit box of a corner fence.
I think the fence is a northeast corner. I can attach screen shots if needed.
I think that this shows a fundamental bug in the AIs of at least 2 mobs.

@unknown, that sounds like MC-7360.

I looked at that bug, and it is basically the same as this one, but this bug report addresses the root cause (pathfinding is flawed). To be more specific, the zombies have the goal of reaching a villager that is in a space occupied by a partial block like a glass pane, fence, or half slabs. Zombie pathfinding (like every other mob's pathfinding) isn't capable of utilizing the empty space that a partial block doesn't use, so the zombie behaves as if the entire space is solid and impassable.

I think it warrants a "relates to" label.

Is this still a concern in the current Minecraft version 1.8.1 Prerelease 3 / Launcher version 1.5.3 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Of course it is. It's pretty obvious. Reopen.

Reopened, thanks

Confirmed for 15w43c & 1.8.8.

Confirmed for 15w44a.

Confirmed for 15w46a

Can confirm this for carpets on fences.

Partly confirmed for 1.9.1-pre3
All fence problems (1, 3 and 4 pictures) are fixed, slab problem is still there. Also I found another problem (2016-03-19_13.04.06.png)

I suppose in the new picture no mob moves on its own?

Also noticed lately that mobs don't go through open iron doors (creepers and zombies mainly).

More observation of path-finding errors:
I observed mobs not realizing they can walk around a fence post. They can see me, but they stay behind the post and never come closer to me, even though they could.
I've included screenshots of various mobs getting stuck in the same place like this.
Granted the screen shots are of range-attack mobs like witches and skels, but creepers and zombies were also getting hung up there. I just failed to screen shot the zombies and creepers doing it. But hung up where they are, even the range attacks were useless. The witch's bottles were breaking on herself, and the skel arrows couldn't get past the fence post.
[media][media]

This is still happening in 1.14.4.

Still in 20w12a.

Still in 1.16 Pre 3

I think this might fit better on the suggestion/feedback site rather than the bug tracker?

I don't believe so, because it causes passive mobs to wander away in the same direction or bunch up in corners of fenced in areas, and that is clearly a bug/unintended behavior.

20w46a