Minecraft:Mob AI
More actions
This article describes the various components of a mob's AI that control its behavior.
Brain
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
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.
By default, sensors run, by default, once every Template:Convert, although individual sensor classes can have a different scan rate. When a sensor runs, it updates its targeting conditions to match the mob's current Template:Attr attribute before performing its targeting condition. The first execution of each sensor is delayed by a random number of ticks, preventing multiple sensors from running simultaneously; the random number is an integer between 0 (inclusive) and the scam rate (exclusive).
| Sensor | Class | Uses |
|---|---|---|
| dummy | DummySensor | default sensor type |
| nearest_items | NearestItemSensor | Template:Flatlist |
| mobs | NearestLivingEntitySensor | Template:Flatlist |
| nearest_players | PlayerSensor | Template:Flatlist |
| nearest_bed | NearestBedSensor | Template:EntityLink |
| hurt_by | HurtBySensor | Template:Flatlist |
| villager_hostiles | VillagerHostilesSensor | Template:EntityLink |
| villager_babies | VillagerBabiesSensor | Template:EntityLink |
| secondary_pois | SecondaryPoiSensor | Template:EntityLink |
| golem_detected | GolemSensor | Template:EntityLink |
| armadillo_scare_detected | MobSensor | Template:EntityLink |
| piglin_specific_sensor | PiglinSpecificSensor | Template:EntityLink |
| piglin_brute_specific_sensor | PiglinBruteSpecificSensorregister | Template:EntityLink |
| hoglin_specific_sensor | HoglinSpecificSensor | Template:EntityLink |
| nearest_adult | AdultSensor | Template:Flatlist |
| nearest_adult_any_type | AdultSensorAnyType | Template:EntityLink |
| axolotl_attackables | AxolotlAttackablesSensor | Template:EntityLink |
| food_temptations | TemptingSensor | Template:Flatlist |
| frog_temptations | TemptingSensor | Template:Flatlist |
| nautilus_temptations | TemptingSensor | Template:Flatlist |
| frog_attackables | FrogAttackablesSensor | Template:EntityLink |
| is_in_water | IsInWaterSensor | Template:EntityLink |
| warden_entity_sensor | WardenEntitySensor | Template:EntityLink |
| breeze_attack_entity_sensor | BreezeAttackEntitySensor | Template:EntityLink |
Sensor parameters
Some sensor classes have parameters, namely MobSensor and TemptingSensor. The list of parameters is below:
| Sensor | scanRate | mobTest | readyTest | toSet | memoryTimeToLive |
|---|---|---|---|---|---|
| armadillo_scare_detected | 5 | Armadillo.isScaredBy(Template:Mono):
|
Armadillo.canStayRolledUp():
Return true only if none of the following occurs to the armadillo:
|
Template:Cd | 80 |
| Sensor | temptations |
|---|---|
| food_temptations | For each mob and item stack, test if the item is food for the mob. For mobs with these sensors, it means the item is tagged: |
| frog_temptations |
Check if the item is Minecraft:frog food (it's on the tag Template:Tag link), regardless of the mob. |
| nautilus_temptations |
Check if the item is Minecraft:nautilus food (it's on the tag Template:Tag link), regardless of the mob. |
Technically, all sensor classes have the scanRate parameter, which defines how many ticks the sensor runs. However, most vanilla sensors use the class's default scanRate value (20 by default, but this can change in certain classes; see below). The only sensor that sets its scanRate is Template:Cd.
Targeting condition
Many sensors need to filter entities based on certain tests. The test conditions can change depending on the sensor's objective.
Each targeting condition has the tags Template:Nbt, Template:Nbt, Template:Nbt, Template:Nbt and selector which are used to perform the test. The selector consists of a predicate that depends on the target, but it can be null.
For sensor targeting conditions, except TemptingSensor, the Template:Nbt is initially defined as Template:Cd, but it is updated to the value of the attribute Template:Attr before the sensor's doTick, selector is null, Template:Nbt is true when testing an attack target, Template:Nbt is false when the target is in the targeter's Template:Cd memory, and Template:Nbt is true.
The test value is a boolean value that depends on the target and the targeter (and can be null), both Minecraft:living entity such that:
- If target and targeter are the same entity, it returns false.
- If the target is not alive or is a player in Minecraft:Spectator mode, returns false.
- If the selector is not null, and the target is valid in the selector test, return false.
- If the targeter is null, Template:Nbt is true, and target is invulnerable, or the difficulty is Minecraft:peaceful, it returns false. The following points assume that targeter is not null.
- If Template:Nbt is true, the targeter can not attack the target or the targeter is allied to the target, return true. See below for more details.
- If Template:Nbt > 0 and the Minecraft:euclidean distance from targeter to target is greater than Template:Cd, it returns false.
- If Template:Nbt is false, the modifier is 1.0; else the modifier starts with Template:Cd (double) and is cumulative:
- Multiplying by Template:Cd if target is a Minecraft:sneaking player,
- Multiplying by Template:Cd if target is Minecraft:invisible and without equipament in Template:Tooltip,
- Multiplying by Template:Cd if target is invisible and has Template:Cd equipaments in humanoid armor slot,
- Multiplying by Template:Cd if target is using the corresponding mob Minecraft:head in the Template:Cd slot (for Minecraft:skeleton, Minecraft:zombie, Minecraft:piglin, Minecraft:piglin brute, and Minecraft:creeper)
- This depends on the component Template:DCL, more specifically, for each target's equipment slot s there is an item with the component Template:DCL equal to s, and the targeter is contained in Template:Cd, the modifier is multiplied by Template:Cd.Template:Upcoming
- The modifier is limited by Template:Cd.Template:Upcoming
- If Template:Nbt is false, the modifier is 1.0; else the modifier starts with Template:Cd (double) and is cumulative:
- If Template:Nbt is true, the targeter is a mob, and it is not possible to draw a straight line from the targeter's eye to the target without intersecting a block Minecraft:collision box, return false.
- Otherwise, it returns true.
Template:A The table below shows when the conditions of a living entity (the targeter) can not attack another (the target). At least one condition must be satisfied for it not to attack.
| Targeter | Can not attack if... |
|---|---|
| Template:EnvLink (except ender dragon and warden) |
|
| Template:EnvLink (except ender dragon and warden) |
|
| |
| Template:EntityLink |
|
| |
| |
| |
| |
| Template:EntityLink |
|
An entity A is an ally of an entity B if A = B, if A considers B as an ally, or if B considers A as an ally. The table below shows when one entity considers another as an ally:
| Targeter | Considers as ally if... |
|---|---|
|
The targeter and the target have a Minecraft:team, and it is the same team. | |
|
The Template:Tooltip is tame, and the owner is the target or considers the target as an ally. | |
|
The target is the Template:Tooltip linked player (has the Minecraft:UUID in memory Template:Cd). | |
|
The target entity type is in the tag Template:Tag link and the target and the targeter don't have a team. | |
| Template:EntityLink |
The target is a Minecraft:vex and the target root ownerTemplate:Fn is the Template:Tooltip or considers the Template:Tooltip as ally. |
Sensor classes
Sensors classes are responsible for detecting a specific type of information and storing the results in one or more memory modules in a mob's brain. In the game's code, these classes are part of the package Template:Cd
| Class | Memory requires | Do tick |
|---|---|---|
| DummySensor | None | Performs no actions |
| AdultSensor | Template:Cd and Template:Cd | Searches the Template:Cd memory for the nearest visible Minecraft:living entity of the same Minecraft:entity type as the mob that is not a Minecraft:baby. Stores the result in the Template:Cd memory.
If no matching adult is found, Template:Cd is set to empty. |
| AdultSensorAnyType |
When setting the nearest visible adult, it tests whether the entity is in the tag Template:Tag link, rather than whether it's in the same entity type as the mob. | |
| AxolotlAttackablesSensor | Template:Cd | Template:Hatnote
Searches the Template:Cd memory for the closest Minecraft:living entity that:
Stores the closest matching entity in the Template:Cd memory. |
| BreezeAttackEntitySensor | Template:Cd, Template:Cd | Template:Hatnote
Updates the Template:Cd and Template:Cd memories (by the super method). It then searches the Template:Cd memory for the attackable entityTemplate:Fn that is not a player in Minecraft:Creative mode or Minecraft:Spectator mode. Stores the first matching entity in the Template:Cd memory. If no matching entity is found, it removes the Template:Cd memory. |
| FrogAttackablesSensor | Template:Cd, Template:Cd | Template:Hatnote
Searches the Template:Cd memory for entity that:
Stores the closest matching entity in the Template:Cd memory. |
| GolemSensor | Template:Cd and Template:Cd | Searches the Template:Cd memory for an Minecraft:iron golem. If one is found, it sets the Template:Cd memory to true with an expiration time of Template:Convert.
scanRate: This sensor runs every Template:Convert by default. It only checks whether at least one iron golem is present. |
| HoglinSpecificSensor | Template:Cd, Template:Cd, Template:Cd, Template:Cd, Template:Cd | Searches the Template:Cd memory for visible adult Minecraft:piglins and Minecraft:hoglins.
Stores the nearest visible adult Minecraft:piglin in the Template:Cd memory and stores visible adult Minecraft:hoglins in the Template:Cd memory. It also stores the number of visible adult piglins and hoglins in the Template:Cd and Template:Cd memories. Searches for the nearest hoglin repellent block within 8 blocks horizontally and 4 blocks vertically, and stores its position in the Template:Cd memory. |
| HurtBySensor | Template:Cd and Template:Cd | Checks the mob's last damageSource.
|
| IsInWaterSensor | Template:Cd | Checks whether the mob is in Minecraft:water. If it is, it sets the Template:Cd memory. Otherwise, it removes the Template:Cd memory. |
| MobSensor | Template:Cd |
If the sensor's readiness condition (readyTest) is met, it searches the Template:Cd memory for a Minecraft:living entity matching the sensor's predicate (mobTest). If a matching entity is found, it sets the sensor's memory (memoryTimeToLive) to |
| NearestBedSensor | Template:Cd | If the mob is a Minecraft:baby:
|
| NearestItemSensor | Template:Cd | Find the Template:Tooltip item that:
The nearest matching item is stored in the Template:Cd memory. If no matching item is found, the memory is set to empty. |
| NearestLivingEntitySensor | Template:Cd and Template:Cd | Template:A
Lists all other Minecraft:living entities that are alive and within a cuboid generated by the mob's hitbox expanded by its Template:Attr in all directions. Sorts the entities by Minecraft:Euclidean distance from the mob and stores the list in the Template:Cd memory. In Template:Cd, storesTemplate:Fn the entities from Template:Cd filtering entities using the mob's targeting conditionsTemplate:Fn |
| NearestVisibleLivingEntitySensor | Template:Cd and a memory defined by the subclass | Template:A Searches the Template:Cd memory for the closest Minecraft:living entity that matches the conditions defined by the subclass.
The matching entity is stored in the memory defined by the subclass. If no matching entity is found, the memory is set to empty. |
| PiglinBruteSpecificSensor | Template:Cd | Searches the Template:Cd memory for the nearest Minecraft:wither skeleton or Minecraft:wither and stores it in the Template:Cd memory.
Stores nearby adult Minecraft:piglins in the Template:Cd memory. |
| PiglinSpecificSensor | Template:Cd | Searches the Template:Cd memory and updates memories related to Minecraft:piglin behavior:
Searches the Template:Cd memory and stores adult Minecraft:piglins and Minecraft:piglin brutes in Template:Cd. Searches for the nearestTemplate:Fn block in the tag Template:Tag link in a box with 17 × 9 × 17 blocks centered on the piglins' position, and stores its position in Template:Cd. Not lit Minecraft:soul campfires are not considered repellents. |
| PlayerSensor | Template:Cd, Template:Cd, Template:Cd and Template:Cd | List all non-Minecraft:Spectator players that are within a Minecraft:Euclidean distance of the mob's Template:Attr. Sorts the players by distance from the mob and stores the list in Template:Cd.
From this list, it creates Template:Cd by filtering players using the mob's targeting conditionsTemplate:Fn. If the resulting list is not empty, stores the first player in Template:Cd. Creates Template:Cd by filtering Template:Cd's list using the mob's attack targeting conditionsTemplate:Fn. If the resulting list is not empty, the first player is stored in Template:Cd. |
| SecondaryPoiSensor | Template:Cd | Scans all blocks within a Template:Tooltip area centered on a villager. If a block matches one of the villager profession's secondary job site blocks, it stores its global position in the Template:Cd memory. It stores all matching blocks.
If no matching blocks are found, it removes the Template:Cd memory. scanRate: This sensor runs every Template:Convert instead of the default 20. |
| TemptingSensor | Template:Cd |
Searches for the Minecraft:player that:
If a matching player is found, it stores the nearest (by Minecraft:euclidean distance) player in the Template:Cd memory. Otherwise, it removes the Template:Cd memory. |
| VillagerBabiesSensor | Template:Cd | Finds all villagers that are babies from the mob's Template:Cd memory and stores them as a list in the Template:Cd memory.
If no visible baby villagers are found, stores an empty list. |
| VillagerHostilesSensor | Template:Cd and Template:Cd |
Template:Hatnote Searches the Template:Cd memory for the nearest Minecraft:living entity matching one of the following hostile entity types and stores it in the Template:Cd memory:
If no matching hostile entity is found, Template:Cd is set to empty. |
| WardenEntitySensor | Template:Cd, Template:Cd | Template:Hatnote
Updates the Template:Cd and Template:Cd memories (by the super method). It then searches the Template:Cd memory for the Template:Tooltip targetable Minecraft:player. If none is found, it searches for the Template:Tooltip targetable non-player Minecraft:living entity. In both cases, only entities that the warden can target are considered. Stores the first matching entity in the Template:Cd memory. If no matching entity is found, it removes the Template:Cd memory. |
Task
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 use information stored in memories. Examples of tasks include a villager walking to its jobsite, a piglin admiring an item, or a warden emerging. Tasks have priorities, so tasks with a higher priority will overrun tasks with lower priority; for example, if a zombie is wandering and it sees a player, it will switch tasks to attacking.
Memory
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
Walking
Mob movement on land varies depending on whether it's hostile or passive. Hostile mobs will try to approach and attack the player when within their detection range, while most passive mobs will attempt to run away when attacked. Some mobs will also try to attack or run away from certain blocks or mobs.
Swimming
Mob swimming works the same way as walking, but in water. While most mobs will just float on water or sink, some can properly swim like Minecraft:fish, Minecraft:drowned, Minecraft:dolphins, Minecraft:turtles, Minecraft:guardians, and Minecraft:elder guardians.
Flying
Mob flying works the same way as walking, but in the air. Most mobs will just fall when suspended in air, with a few exceptions. Mobs with Minecraft:Slow Falling, Minecraft:levitation, and the Minecraft:chicken don't fly normally but can float in mid-air. [[Minecraft::Category:Flying mobs]] contains a list of all mobs that can pathfind in air.
Goals
Goals are a simple AI system used primarily by mobs that already existed before the brain AI. However, there are recent mobs that use both AIs simultaneously, for example, the Minecraft:happy ghast.
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
List of goals that are used by many different mobs.
| Goal | Description | Notes |
|---|---|---|
| Active Target | Select an entity to target for chasing and attacking | |
| Ambient Stand | Untamed horse bucks when player tries to ride it | |
| Attack | Attack target | |
| Attack with Owner | Tamed animal attacks a target mob attacked by owner | |
| Avoid Entity | Mob runs away from another mob that it is afraid of (e.g. skeletons running from wolves) | |
| Bow Attack | Attack target with bow | |
| Breathe Air | Mob that can drown tries to move out of water | |
| Cat Lie on Bed | Tamed cat lies down on bed | |
| Cat Sit on Block | Cat sits on bed, chest, or furnace | |
| Chase Boat | Chase after boat ridden by player | Unused |
| Crossbow Attack | Attack target with crossbow | |
| Destroy Egg | Destroy turtle eggs | |
| Disableable Follow Target | Raid entity stops following target | Unused |
| Dive Jump | Mob jumps up and dives down | |
| Dolphin Jump | Dolphin jumps out of water | |
| Door Interact | Mob tries to open a door | |
| Eat Grass | Mob grazes on grass | |
| Flee Sun | Move out of direct line-of-sight with sky during day | |
| Float | Mob floats in water | |
| Follow Flock Leader | Fish tries to follow the leader of a school of fish | |
| Follow Mob | Mob follows another mob | |
| Follow Owner | Tamed mob follows owner | |
| Follow Parent | Baby mob follows its parent | |
| Go to Walk Target | Mob walks to a target | |
| Hold in Hands | Mob holds an item in its main hand | |
| Horse Bond with Player | Horse attempts to bond with player attempting to tame it | |
| Iron Golem Look | Iron golem looks at a villager | |
| Iron Golem Wander Around | Iron golem wanders around village | uses points of interest |
| Llama Follow Caravan | Llamas form and follow a caravan | |
| Leap At Target | Mob jumps towards target | cats, foxes, ocelots, spiders |
| Long Door Interact | Open a door, then close it after a delay | |
| Look At Entity | Mob looks at another mob | |
| Look At Player | Mob looks at player | |
| Look At Trading Player | Villager or wandering trader looks at player while trading | |
| Melee Attack | Mob paths to target and attacks | |
| Move Into Water | Mob paths to water | |
| Move Through Village | Mob moves between points of interest in a village | |
| Move To Raid Center | Raiders move toward village after spawning | |
| Move To Target Position | Mob paths to a specific block | |
| Panic | Mob panics and runs away when damaged | |
| Powder Snow Jump | Mob dives into powder snow | foxes |
| Prioritized Goal | Used to override the default priority of a goal | |
| Projectile Attack | Mob attacks target with a projectile | arrow, spit, trident, potion, snow ball, wither skull, not fireballs |
| Raid Goal | Raiders target villagers | |
| Random Look Around | Mob looks around in random directions | |
| Random Stroll | Move to a nearby random position | |
| Revenge | Target entity that attacked the mob | |
| Run Around Like Crazy | Untamed horse runs around randomly when ridden by a player | |
| Spear Use | Mob attacks target with spear | |
| Swell | Creeper attempts to explode near its target | |
| Tempt | Mob follows player holding breeding item | |
| Water Avoiding Random Stroll | Move to a nearby random position, while actively avoiding water | |
| Wander Around Far | Move to a random position, sometimes farther away than Wander Around goal | |
| Zombie Attack | Attack goal for zombies and zombie variants |
Lists of mob goals
Lists of goals and associated priorities for individual mobs.
| Goal | Priority | 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 | Looks away from Entities |
| Look at Entity | 8 | Looks at nearest Entities |
Pathfinding
Pathfinding is the system used by mobs to navigate through the world. Mobs that use pathfinding calculate routes through the environment and follow these routes using their navigation system. Different mobs use different types of navigation depending on their movement abilities, such as Minecraft:walking, Minecraft:swimming, or Minecraft:flying.
The default navigation type for mobs is ground path navigation, although individual mobs can replace it with a different navigation implementation.
Pathfinding is controlled by a mob's AI. Goals and behaviors can request movement to a location or entity, causing the mob's navigation system to calculate and follow a path. The navigation system is updated every Minecraft:tick while the mob's AI is active.
A mob is considered to be pathfinding when its navigation system has an active path. The path ends when the mob reaches its destination, the path becomes invalid, or the navigation is stopped.
The navigation system controls how mobs follow paths after they have been calculated.
A navigation system stores the mob's current path, movement speed, and destination. During each AI update, the navigation system checks the current path, advances through nodes that have been reached, and sends movement instructions to the mob's movement controls.
Navigation can be stopped manually, which clears the mob's current path. A mob is considered to be navigating when it has an active path that has not been completed.
Different mobs use different navigation systems depending on their movement type. Ground mobs generally use ground navigation, while Minecraft:aquatic and [[Minecraft::Category:Flying mobs|flying mobs]] use specialized navigation systems.
Navigation systems can also perform checks while moving, such as:
- When a mob becomes stuck.
- Recalculating paths when needed.
- Whether a mob can move directly between two points.
- Adjusting paths around certain blocks.
Path following
After a path is created, mobs follow the path by moving from node to node. A node represents a position that the mob must reach while traveling.
A mob advances to the next node when it is close enough to its current node. Some paths allow mobs to skip nodes when moving directly toward a later point would be safe.
While following a path, mobs can become stuck if they fail to make sufficient progress. The navigation system checks movement over time and stops the path if the mob cannot continue.
Pathfinding penalties
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 pathfinding (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 | Template:BlockLink |
| fence | -1 | Template:BlockLink Template:BlockLink Template:BlockLink (closed) |
| lava | -1 | Template:BlockLink |
| unpassable rail | -1 | Template:BlockLink |
| damage - other | -1 | Template:BlockLink Template:BlockLink |
| closed wood door | -1 | Template:BlockLink |
| closed iron door | -1 | Template:BlockLink |
| open | 0 | Template:BlockLink Template:BlockLink Template:BlockLink |
| walkable | 0 | Template:BlockLink with pressure plate on top (under the mob) |
| walkable door | 0 | a door the mob can open |
| trapdoor | 0 | Template:BlockLink Template:BlockLink Template:BlockLink |
| danger - powder snow | 0 | neighboring block is Template:BlockLink |
| open door | 0 | open wood or iron door |
| cocoa | 0 | Template:BlockLink |
| damage - cautious | 0 | Template:BlockLink Template:BlockLink |
| danger - trapdoor | 0 | neighboring block is Template:BlockLink |
| breach water | 4 | there is an air block above a water block |
| water | 8 | Template:BlockLink |
| water border | 8 | neighboring block is Template:BlockLink |
| danger - fire | 8 | neighboring block is: Template:BlockLink Template:BlockLink Template:BlockLink Template:BlockLink Template:BlockLink |
| danger - other | 8 | neighboring block is: Template:BlockLink Template:BlockLink |
| honey | 8 | Template:BlockLink |
| damage - fire | 16 | Template:BlockLink Template:BlockLink Template:BlockLink Template:BlockLink Template:BlockLink |
- Mob pathfinding penalty overrides
The following mobs override the default pathfinding penalty for some blocks:
| Mob | Penalty Type | Penalty |
|---|---|---|
| Template:EntityLink | water | 0 |
| Template:EntityLink | damage - fire | -1 |
| water | -1 | |
| cocoa | -1 | |
| fence | -1 | |
| water border | 16 | |
| Template:EntityLink | water | 0 |
| Template:EntityLink | danger - other | 0 |
| damage - other | 0 | |
| Template:EntityLink | trapdoor | -1 |
| water | 4 | |
| Template:EntityLink | powder snow | -1 |
| danger - powder snow | -1 | |
| Template:EntityLink Template:EntityLink |
damage-fire | -1 |
| danger - fire | 16 | |
| Template:EntityLink | danger-fire | -1 |
| damage - fire | -1 | |
| cocoa | -1 | |
| Template:EntityLink | water | -1 |
| danger - powder snow | -1 | |
| damage - cautious | -1 | |
| Template:EntityLink | water | -1 |
| lava | 0 | |
| danger - fire | 0 | |
| damage - fire | 0 | |
| Template:EntityLink | close iron door | -1 |
| closed wood door | -1 | |
| open door | -1 | |
| water | 0 | |
| Template:EntityLink | powder snow | -1 |
| danger - powder snow | -1 | |
| Template:EntityLink Template:EntityLink |
damage - fire | -1 |
| danger - fire | 16 | |
| Template:EntityLink | water | -1 |
| danger - fire | 8 | |
| damage - fire | 8 | |
| lava | 8 | |
| Template:EntityLink | danger - trapdoor | -1 |
| damage - fire | -1 | |
| Template:EntityLink | water | 0 |
| Template:EntityLink | water | -1 |
| Template:EntityLink | water | 0 |
| Template:EntityLink | leaves | 0 |
| Template:EntityLink | unpassable rail | 0 |
| damage - fire | 0 | |
| danger - fire | 0 | |
| damage - other | 8 | |
| powder snow | 8 | |
| lava | 8 | |
| water creatures | water | 0 |
| Template:EntityLink | lava | 8 |
| Template:EntityLink | lava | 8 |
| animal | damage - fire | -1 |
| danger - fire |
Pathfinding on land
- All entities move based on random targets that are generated every tick with a priority toward their entity-specific goals.
- These targets can be located anywhere in 3D space within the entity range and are only generated when wandering or when they have no goals.
- For every target, a path is generated; with the entity preferring the path with the lowest score regarding the Pathfinding penalties.
- If an entity cannot take any paths with a low enough score, or any paths without a score of -1, the entity will not move until one is found.
- If an entity's target is located inside a block (including water), the target is moved to the nearest air block above it.
This means every entity, when wandering, will always prefer to pathfind to a block with the most blocks below it within range.
Due to the higher chance that a target will be generated within the blocks below it and moved up to the nearest air block above before generating a path.
Pathfinding in water
- Pathfinding in water is roughly the same as land; however, most entities, excluding fish and drowned, will bounce on the surface, preferring land due to the Pathfinding penalties of water.
Pathfinding in air
- Pathfinding in air is roughly the same as land; however, few entities can pathfind to air.
See also
Template:Navbox Java Edition technical
Minecraft:de:Künstliche Intelligenz Minecraft:ja:Mob AI Minecraft:pt:IA de criatura Minecraft:zh:生物AI