Mob AI

Jump to navigation Jump to search
This article is a work in progress.
 
Please help expand and improve it. The talk page may contain suggestions.

This article describes the various components of a mob's AI that control the mob's behavior

Brain[edit | edit source]

Some mobs use a complex AI system called a brain. A mob's brain stores memories (data), a list of tasks that can be performed, and a list of sensors used to determine which tasks it can perform.

Sensor[edit | edit source]

Sensors are used to detect if a mob with a brain can perform certain tasks. Examples of sensors include, a sensor to detect if an armadillo should be scared, a sensor to detect the nearest player, and a sensor to detect if a mob is in water.

Task[edit | edit source]

Tasks are activities that mobs with brain AI systems can perform. Sensors are used to determine if a task can be performed, and tasks may information stored in memories. Examples of tasks include a villager walking to its jobsite, a piglin admiring an item, or a warden emerging.

Memory[edit | edit source]

Memories are used to store data, and are used when mobs perform tasks. Examples of memories include a list of all visible mobs in range, the location of a villager's jobsite block, and any cooldowns the mob may have.

Control[edit | edit source]

Walking[edit | edit source]

This section of the article is empty.
 
You can help by expanding it.

Swimming[edit | edit source]

This section of the article is empty.
 
You can help by expanding it.

Flying[edit | edit source]

This section of the article is empty.
 
You can help by expanding it.

Goals[edit | edit source]

Goals are a simple AI system used by mobs that don't use brain AI. Goals can range from wandering around, opening doors, attacking another mob, and more. Each type of mob that uses goals has its own defined list of goals, and each goal has a priority. Mobs attempt to perform the lowest priority goal they can, and may switch goals if there is an opportunity to pursue a lower priority goal. For example, if a zombie is targeting and chasing a villager (priority of 3) and a player comes within the detection range of the zombie, the zombie may target and chase the player (priority of 2) instead.

List of goals[edit | edit source]

List of goals that are used by many different mobs.

Lists of mob goals[edit | edit source]

Lists of goals and associated priorities for individual mobs.

Zombie
Goal Priority [hide]Notes
Revenge 1 Attack entity that damaged the zombie
Active Target - Player 2 Target the player
Zombie Attack 2 Attack current target
Active Target - Iron Golem 3 Target Iron Golem
Active Target - Merchant 3 Target Villager or Wandering Trader
Destroy Egg 4 Break turtle eggs
Active Target - Turtle 5 Target baby turtle
Wander Around Far 7
Look Around 8
Look at Entity 8

Pathfinding[edit | edit source]

Pathfinding penalties[edit | edit source]

Zombified piglin starts pathfinding to a turtle egg
Due to pathfinding penalties, the zombified piglin takes an indirect path to the turtle egg, pathing through wither roses and taking damage, instead of pathing through the lava or magma blocks, which do not damage the zombified piglin

When pathfinding to a target, mobs will sometimes avoid certain blocks (usually blocks that cause damage or slow the mob down). These blocks have a penalty associated with them. Generally, mobs try to path through blocks with the smallest penalty. There are some blocks that most mobs cannot path through; these all have a penalty of -1.

The following table is a list of all pathfinding penalties and their default values. Each type of pahtfinding (land, water, air) uses its own subset of these penalties. Some mobs override these default values.

Penalty type Penalty Description
blocked -1 can't pathfind through block (most full solid blocks)
powder snow -1 powder snow
fence -1 fences
walls
fence gates (closed)
lava -1 lava
unpassable rail -1 rail
damage - other -1 cactus
sweet berry bush
closed wood door -1 wood door
closed iron door -1 iron door
leaves -1 leaves
open 0 air
cave air
void air
walkable 0 tnt with pressure plate on top (under the mob) https://minecraft.wiki/w/TNT
walkable door 0 a door the mob can open
trapdoor 0 trapdoors
lily pad
big dripleaf
danger - powder snow 0 neighboring block is powder snow
rail 0 rail
open door 0 open wood or iron door
cocoa 0 cocoa
damage - cautious 0 wither rose
pointed dripstone
danger - trapdoor 0 neighboring block is trapdoor
breach water 4 there is an air block above a water block
water 8 water
water border 8 neighboring block is water
danger - fire 8 neighboring block is:
fire
lava
magma block
lit campfire
lava cauldron
danger - other 8 neighboring block is:
cactus
sweet berry bush
honey 8 honey block
damage - fire 16 fire
lava
magma block
lit campfire
lava cauldron
Mob pathfinding penalty overrides

The following mobs override the default pathfinding penalty for some blocks:

Pathfinding on land[edit | edit source]

This section of the article is empty.
 
You can help by expanding it.

Pathfinding in water[edit | edit source]

This section of the article is empty.
 
You can help by expanding it.

Pathfinding in air[edit | edit source]

This section of the article is empty.
 
You can help by expanding it.

Navigation[edit | edit source]