Wandering
Wandering is a mob walking to a space it picks at random.
Choosing a space
A mob picks 10 spaces at random, up to 6 blocks away in x and z and 3 up or down, and walks towards the one that scores best. Where several tie, the first picked wins, so each is equally likely. The spaces are not checked: one can be in mid-air, underwater or inside a solid block.
| Mob | Best space |
|---|---|
| Zombie, Skeleton, Spider, Creeper, Pig Zombie, Monster | lowest light level |
| Giant | highest light level |
| Pig, Cow, Sheep, Chicken, Wolf | directly above a grass block; otherwise highest light level |
A space above grass beats any light level. Light is read as it stands at that moment, so open sky reads 4 at night.
Squid, slimes and ghasts do not wander this way.
Solid ground reads as dark
The inside of a full opaque block has light level 0 unless the block gives off light. Torchlight in the space above does not reach it.
To a hostile mob, a space in the ground is the darkest there can be. On flat ground, 3 of the 7 heights it picks from are below its feet, so one of its 10 spaces lands in the ground more than 99% of the time, and it picks among those at random. Torches on a floor of full blocks do not steer it. Light decides only between open spaces: over slabs, stairs, farmland and blocks light passes through, which read as bright as the air beside them.
To an animal, a space in the ground scores worst.
Walking there
If the mob cannot reach the space it picked, it walks to the reachable space closest to it. A space picked inside flat ground brings the mob to the surface directly above. If nothing reachable is closer than where the mob stands, it stays put.
When a mob wanders
| Mob | Chance of a new pick each tick |
|---|---|
| Standing, with no path | about 1 in 40 |
| Walking a path | 1 in 80; the new path replaces the old |
| With a target, and no path | none; it paths to the target |
| With a target, on a path | 1 in 80, on the 19 ticks in 20 it does not path to the target |
A walking mob also has a 1 in 100 chance each tick to drop its path and stop.
There is no new pick while a skeleton can see its target within 10 blocks, while a creeper swells, or while a wolf sits or shakes itself dry.
Standing
A mob with no path stands still and turns at random. Each tick it has a 1 in 50 chance to look at the nearest player within 8 blocks, for 11 to 30 ticks.