Minecraft Java Edition – Why Sheep Crowd Together

minecraft-java-edition

The sheep have lots of room to move around, but instead are choosing to squish themselves against this wall. It's so thick that I can hardly move around in that cluster.

enter image description here

When I pull out some wheat, they do move to me. But once I put the wheat away, they go right back to those clusters. Why is this happening?

Best Answer

The way of pathfinding in Minecraft works: whenever the AI decides to perform a random walk, a full opaque solid block is selected randomly within a cube centered on the mob feet: up to 7 blocks up or down and 10 blocks away in x, z directions. Then the mob moves towards that block, and stops either upon reaching it, or getting stuck somewhere along the way. source

Your farm is dug into the ground, meaning there's lots and lots of dirt just past the walls - therefore random walking attempts towards the wall will be attempted frequently; the blocks under ground of the farm floor don't create a directional bias so only some sheep wander back towards the center of the paddock; most that pathfind towards the wall just stay there.