Mob AI

Each type of mob in Minecraft has a certain AI (Artificial Intelligence) system with different behaviors and mechanics. Passive mobs will flee in random directions after being hurt, while hostile mobs will face and chase/attack the Player as soon as they come close. Neutral mobs will remain neutral until a player or mob attacks it, at which point the neutral mob will turn hostile toward and attack the entity that hit it.

All mobs
All mobs randomly walk around. When they come to a 1 block high wall, they jump. They avoid falling 4 or more blocks (to avoid taking fall damage). They all float in water (except for iron golems, which sink).

Farm animals
Farm animals are attracted to certain items held by the player (wheat for cows, mooshrooms, and sheep; carrots for pigs; and seeds for chickens). If two animals of the same species are fed that item within five minutes of each other, they will walk towards each other into a "kiss" to spawn a baby animal of the same species. Upon taking damage, an animal will sprint in random directions. Animals avoid lava and drops of more than one block. Farm animals may wander into water in their path, and will always swim upwards.

Pig being ridden by a player
If the player is holding a carrot on a stick, the pig moves in the direction that the player faces. The pig gradually speeds up until it moves at 5 blocks per second. It will stop responding to the player if it touches water. The pig will slightly speed up when the player right-clicks.

Villager
Adult villagers will 'socialize'. This is modeled by a pair of villagers moving to face one another or the player at a distance of about a meter, as if they were talking. Sometimes larger groups will form in this way. Villager children 'socialize' in the same way as the adults, and will also sprint around the village, seemingly playing tag. All villagers will attempt to enter houses when it is raining or at night, and will also flee from zombies. Note that identifying a 'house' is a challenge for a computer AI, and this may give rise to unexpected villager behavior.

Villagers will neither attack nor flee if the player attacks them, but if their village is large enough to have spawned an iron golem it may arrive to protect them. Villagers will also sometimes stop and stare at the golem. The golem may in turn offer them a poppy. When an iron golem offers children a poppy, they will approach slowly and run away as soon as they have the poppy.

Villagers will breed depending on the number of "houses" available.

Bat
Bats are the only passive mob in Minecraft that fly, and the only flying mob in the the Overworld. Bats spawn in caves, where the light level is 10 or less (higher than for hostile mobs, which is 7 or less) and hang upside-down during the day. At night or when approached by the Player, bats will take off and fly around randomly. All bats will attempt to enter a cave when daylight approaches, even though they are not affected by daylight.

Squid
Squid spawn and swim in water. If not in water, they don't move at all. Their tentacles always move, even if they're not in water. If they are not in water they will suffocate and die within a few seconds.

Ocelot
Ocelots sprint away from a player if the player is close, unless the player is still. When a player holds raw fish, the ocelot slowly moves closer. Ocelots can hunt chickens.

Tamed cat
A tamed cats will follow its owner, and if near its owner, it will wander within 8 blocks. Tamed cats that are standing will teleport to its owner if more than 16 blocks away. Unlike wolves, cats don't attack. Tamed cats will often sit on chests, preventing players from using them. Tamed cats also "scare" creepers away, however they do not attack them.

Wolf
Wolves are neutral mobs that spawn in forest and taiga biomes. Wolves live in packs of up to ten, and will naturally attack sheep and skeletons. They will wander around in the pack and ignore you, but if you attack one, all wolves in the vicinity will turn hostile. They will shake when getting out of water. Wolves only despawn when hostile.

Tamed wolf
A tamed wolf will follow its owner, and if near its owner, it will wander within 8 blocks. Tamed wolves that are standing will teleport to their owner if more than 16 blocks away. Wolves will attack any mob or player (with the exception of creepers) that its owner attacks. It will also attack any mob or player that attacks its owner. Currently in PE, tamed wolves will attack creepers, causing the creeper to detonate.

Enderman
Endermen are neutral mobs that spawn in the End and the Overworld. They will pick up blocks and carry them around, eventually replacing them somewhere else. This block handling is random; i.e. it will not purposely tear down your wall, but may "accidentally" breach your defenses. They are passive at first, but turn hostile if you put the crosshairs on its head or torso. Unlike wolves and zombie pigmen, endermen near it will stay neutral. It teleports upon taking damage (unless you look at its legs), sometimes when attacking, or if it is hit with a projectile. In daylight, endermen will become peaceful and will teleport away if approached by a player.

Zombie Pigman
Zombie Pigmen are undead neutral mobs that roam around the Nether in packs of 4. They are peaceful at first, but when attacked, all of them in the area attack you, like wolves. They are immune to fire/lava damage. They move faster than zombies when provoked. Some zombie pigmen can pick up items, making it dangerous to drop your sword.

Iron Golem
Iron golems move slowly when passive, and "sprint" when provoked. Naturally spawned iron golems attack hostile and neutral mobs, and will attack players if they attack it or a nearby villager; or if the player has a bad reputation in the village that the iron golem is in. Iron golems sometimes offer villagers poppies.

Zombie
Zombies attack by moving relatively slowly towards a player or a villager, and will damage them on contact. They do not try to avoid being hit, and will continue to pursue the player even when being counter-attacked. Some zombies have the ability to bang on wooden doors (and break them in Hard mode). They cannot break through iron doors. They slow down for a few seconds when hit. They are healed by damage potions and damaged by health potions. Some zombies can pick up items if the gamerule "mobGriefing" is set to true.

Zombies will attempt to find and run to the cover of nearby trees or caves, or enter bodies of water to protect themselves from burning up during the day. They also try to avoid 4+ block holes and lava when possible. If the player is on the same level as the mob, with a hole in between, the mob will go around the hole if possible.

Skeleton
Skeletons will circle the player with a constant radius while attacking in an attempt to evade attacks. They are healed by damage potions and damaged by health potions. They will also shoot other skeletons if hostile towards them.

Skeletons also attempt to seek out the cover of nearby trees or caves, or enter bodies of water to protect themselves from burning up during the day. Skeletons will also follow the player around obstacles should the player try to hide from the skeleton. They also attemp to avoid falls if they can. Some skeletons can pick up items.

Wither Skeleton
Wither Skeletons attack by charging at the player. (If a normal skeleton manages to pick up a sword, it will do the same, due to them sharing the same Entity ID.) Wither skeletons inflict the effect upon attacking.

Spider
Spiders move at the same speed as the player, and attack by leaping. If encountered in light levels of 9 or higher, they don't try to attack unless attacked first. However, a spider that spots a player in a light level less than 9 and then ventures into a higher light level will remain hostile. Spiders can climb walls. Since they are 2 blocks wide, they can't fit through doorways.

Cave Spider
Cave spiders behave the same as spiders, except that they can fit through smaller spaces, and they poison their target in normal or hard difficulty.

Creeper
Creepers will silently approach any player they see, attempting to get within a one-block range by path-finding around obstacles in their way. When a player is within one block, they will emit a sibilant hiss and ignite a 1.5-second fuse. If the player leaves this one-block range within 1.5 seconds, the creeper will abort its countdown and resume its attempts to reach the player. But if the player is still within several blocks of the creeper (distance increases with difficulty) when the fuse runs out, the Creeper detonates, destroying blocks in the area as well as significantly damaging the player.

Unlike most mobs, creepers remain a persistent threat during the day, since they neither burn nor become passive in the sunlight.

Creepers will run away from ocelots, but will continue to chase the player.

Slime
Unlike other mobs, Slimes don't target players; they just move toward the closest one. When no player is within 16 blocks, they hop in one direction and turn occasionally. Slimes will not avoid fire, deep falls, or other things that hurt them, making them easy to trap and kill. Slimes can swim.

Ghast
Ghasts can seek out players from 100 blocks away. Once they come within range with a line of sight, they shoot fireballs, which have ⅓ the explosive force as a Creeper and light surrounding blocks on fire. Unlike other hostile mobs, Ghasts will not attempt to draw close to the player once aggravated, but will instead hover about 24 blocks from the player, firing repeatedly at them. This is since ghasts don't have a search mode.

Spider Jockey
The spider controls how both mobs move. Other than that, both mobs act normal.

Blaze
Blazes fly when aggressive, and sink when passive. About every 10 seconds, they will catch fire, then shoot 3 fireballs at their target in quick succession. They tend to strafe right (your left if you're facing them) when attacking. Blazes are damaged by water and snowballs, as well as rain.

Ender Dragon
The Ender Dragon flys around the End, occasionally swooping down and charging at the player. It can regenerate health by flying near one of the multiple End Crystals in the End. The Ender Dragon only takes $1/4$ damage unless hit in the head. The Ender Dragon will fly away from the player if they look at it, except when it charges them.

Wither
When spawned by the player, they will be invulnerable for about 10 seconds, then they will create a huge explosion. They fly 4 blocks above their target. Their three heads (projectiles) will attack the player and all mobs that are not undead, and each head can attack a different mob. However, movement is only controlled by the middle head. Withers will break blocks around them upon taking damage. When the wither reaches half health, it will stop flying, will be immune to arrows and will start regenerating hp.

History
Künstliche Intelligenz 生物AI