AI Goals
Define custom AI behavior for your entity. When AIGoals is present, it overrides any Behavior preset.
Syntax
Each goal can be simple or have parameters. You can optionally specify priority with a number prefix:
AIGoals:
- float # Simple (uses default priority)
- meleeattack{speed=1.2} # With parameters
- 1 swell{radius=3} # With explicit priority (lower = higher priority)
- 2 meleeattack # Priority prefix without params
Priority Syntax: X goalname or X goalname{params} where X is the priority number.
Lower numbers run first (priority 0 runs before priority 1).
Goal Types
float
Keeps the entity above water.
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 0
- float
panic
Makes the entity flee when hurt.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.25 | Movement speed while fleeing |
Priority: 1
- panic
- panic{speed=1.5}
meleeattack
Performs melee attacks on the current target.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Chase speed |
| alwaysfollow | boolean | false | Follow through walls |
Priority: 2
- meleeattack
- meleeattack{speed=1.2, alwaysfollow=true}
If you have attack goals but no AITargets, the entity defaults to hurtbytarget (only attacks when attacked first).
randomstroll
Wanders randomly when idle (avoids water).
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 0.8 | Wander speed |
Priority: 7
- randomstroll
- randomstroll{speed=0.5}
lookatplayer
Looks at nearby players.
| Parameter | Type | Default | Description |
|---|---|---|---|
| range | double | 8.0 | Look range in blocks |
Priority: 8
- lookatplayer
- lookatplayer{range=12.0}
Combat Goals
leapattarget
Leaps at the current target (like spiders and wolves).
| Parameter | Type | Default | Description |
|---|---|---|---|
| leapheight | float | 0.4 | Vertical velocity of the leap |
Priority: 4
- leapattarget
- leapattarget{leapheight=0.5}
movetowardstarget
Approaches the current target aggressively (like iron golems).
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 0.9 | Movement speed |
| within | float | 32.0 | Maximum distance to start approaching |
Priority: 2
- movetowardstarget
- movetowardstarget{speed=1.0, within=16}
avoidentity
Flees from specified entity types (for cowardly mobs).
| Parameter | Type | Default | Description |
|---|---|---|---|
| target | string | player | Entity type to avoid (e.g., player, wolf, cat, ocelot) |
| distance | float | 6.0 | Distance to maintain from target |
| walkSpeed | double | 1.0 | Walking speed when avoiding |
| sprintSpeed | double | 1.2 | Sprint speed when close |
Priority: 1
- avoidentity
- avoidentity{target=player, distance=8}
- avoidentity{target=wolf, distance=6, walkSpeed=1.0, sprintSpeed=1.2}
- avoidentity{target=cat, distance=6}
Skeletons avoid wolves, and creepers avoid cats and ocelots in vanilla Minecraft. Use this goal to replicate that behavior.
swell
Creeper-like swelling behavior that triggers an explosion when close to targets.
| Parameter | Type | Default | Description |
|---|---|---|---|
| radius | int | 3 | Explosion radius in blocks |
| fuse | int | 30 | Ticks before explosion (1.5 seconds default) |
| powered | boolean | false | Whether explosion is powered (2x radius) |
Priority: 1
- swell
- swell{radius=4, fuse=40}
- swell{radius=3, fuse=30, powered=true}
The swell goal makes the entity start swelling when within 3 blocks of a target. If the target moves away (>7 blocks) or breaks line of sight, swelling stops.
rangedattack
Generic ranged attack behavior with customizable projectiles (snowballs, potions, fireballs, etc.).
| Parameter | Type | Default | Description |
|---|---|---|---|
| projectile | string | snowball | Projectile type (see below) |
| potion | string | harming | Potion effect (for splash/lingering potions) |
| attackInterval | int | 60 | Ticks between attacks |
| attackRadius | double | 15.0 | Maximum attack range |
| speed | double | 1.0 | Movement speed when chasing |
Projectile Types:
| Projectile | Description |
|---|---|
snowball | Snow golem style (default) |
egg | Thrown eggs |
small_fireball | Blaze-style fireball |
fireball | Ghast-style large fireball |
splash_potion | Splash potion with effect |
lingering_potion | Lingering potion cloud |
arrow | Shoots arrows |
trident | Throws trident |
Potion Types (for splash_potion and lingering_potion):
harming, healing, poison, regeneration, slowness, weakness, strength, swiftness, invisibility, fire_resistance, night_vision, water_breathing, turtle_master, slow_falling
Priority: 4
# Snow golem style (default)
- rangedattack{projectile=snowball}
# Witch-like potion thrower
- rangedattack{projectile=splash_potion, potion=poison, attackInterval=60}
# Blaze-like fireball shooter
- rangedattack{projectile=small_fireball, attackInterval=40}
# Ghast-like entity
- rangedattack{projectile=fireball, attackInterval=80}
# Drowned-like trident thrower
- rangedattack{projectile=trident, attackInterval=50}
rangedbowattack
Skeleton-style bow attack with strafing behavior.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Movement speed |
| attackInterval | int | 20 | Ticks between shots |
| attackRadius | float | 15.0 | Maximum attack range |
Priority: 4
- rangedbowattack
- rangedbowattack{attackInterval=30, attackRadius=20}
The entity should have a bow equipped (Equipment: mainhand: minecraft:bow) for proper behavior.
Sun Avoidance Goals
fleesun
Makes the entity seek shade when in sunlight.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Movement speed when fleeing |
Priority: 2
- fleesun
- fleesun{speed=1.2}
restrictsun
Prevents pathfinding through sunlit areas.
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 0
- restrictsun
Combine fleesun and restrictsun for undead-style sun avoidance:
- restrictsun
- fleesun{speed=1.2}
Pet Goals
These goals work with the Taming module.
sitwhenordered
Makes tamed pets sit when ordered by their owner.
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 1
- sitwhenordered
followowner
Makes tamed pets follow their owner, with teleportation when too far.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Movement speed |
| startdistance | float | 10.0 | Distance to start following |
| stopdistance | float | 2.0 | Distance to stop following |
| teleportdistance | float | 12.0 | Distance to trigger teleport |
Priority: 6
- followowner
- followowner{speed=1.2, startdistance=8, stopdistance=3, teleportdistance=15}
Animal Behaviors
tempt
Makes the entity follow players holding certain items.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Movement speed when following |
| items | string | wheat | Items that tempt (semicolon-separated) |
| canscare | boolean | false | Whether running scares the entity away |
Priority: 3
- tempt{items=wheat}
- tempt{speed=1.2, items=wheat;carrot;potato, canscare=true}
eatblock
Eats grass blocks (like sheep).
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 5
- eatblock
Environment Goals
breakdoor
Breaks doors (like zombies on hard difficulty). Automatically configures the entity's pathfinding to plan routes through closed doors.
| Parameter | Type | Default | Description |
|---|---|---|---|
| breaktime | int | 240 | Ticks to break door (12 seconds default) |
Priority: 1
- breakdoor
- breakdoor{breaktime=120}
For complete door-breaking behavior, combine with nearestplayer{mustsee=false}:
AIGoals:
- float
- breakdoor{breaktime=120}
- meleeattack
- wateravoidingrandomstroll
AITargets:
- nearestplayer{mustsee=false} # Can sense through doors
This lets the entity detect players through closed doors and path to break them down.
opendoor
Opens and optionally closes doors (like villagers). Automatically configures the entity's pathfinding to plan routes through closed doors.
| Parameter | Type | Default | Description |
|---|---|---|---|
| closedoor | boolean | true | Whether to close door after passing |
Priority: 5
- opendoor
- opendoor{closedoor=false}
Movement Goals
lookaround
Randomly looks around when idle.
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 9
- lookaround
followmob
Follows other nearby mobs.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Movement speed |
| stopdistance | float | 3.0 | Distance to stop following |
| areasize | float | 7.0 | Search radius for mobs to follow |
Priority: 6
- followmob
- followmob{speed=1.0, stopdistance=2, areasize=10}
Aquatic Goals
randomswim
Swims randomly in water (for aquatic mobs).
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Swimming speed |
| interval | int | 120 | Ticks between swim attempts |
Priority: 4
- randomswim
- randomswim{speed=1.2, interval=80}
wateravoidingrandomstroll
Wanders randomly while avoiding water.
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Movement speed |
| probability | float | 0.001 | Chance per tick to start wandering |
Priority: 6
- wateravoidingrandomstroll
- wateravoidingrandomstroll{speed=0.8, probability=0.002}
wateravoidingrandomflying
Flies randomly while avoiding water (for flying mobs).
| Parameter | Type | Default | Description |
|---|---|---|---|
| speed | double | 1.0 | Flying speed |
Priority: 6
- wateravoidingrandomflying
- wateravoidingrandomflying{speed=1.5}
breathair
Surfaces periodically to breathe (like dolphins).
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 0
- breathair
tryfindwater
Seeks water when on land (for aquatic mobs).
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 1
- tryfindwater
climbpowdersnow
Climbs on top of powder snow (like goats).
| Parameter | Type | Default | Description |
|---|---|---|---|
| - | - | - | No parameters |
Priority: 1
- climbpowdersnow
Priority System
Goals execute based on priority (lower number = higher priority):
| Priority | Goal |
|---|---|
| 0 | float, breathair, restrictsun |
| 1 | panic, sitwhenordered, avoidentity, breakdoor, tryfindwater, climbpowdersnow, swell |
| 2 | meleeattack, movetowardstarget, fleesun |
| 3 | tempt |
| 4 | leapattarget, randomswim, rangedattack, rangedbowattack |
| 5 | eatblock, opendoor |
| 6 | followowner, followmob, wateravoidingrandomstroll, wateravoidingrandomflying |
| 7 | randomstroll |
| 8 | lookatplayer |
| 9 | lookaround |
Override priority on any goal using the prefix syntax:
- 1 meleeattack # Priority 1 (higher than default 2)
- 0 float # Priority 0 (runs first)
- 3 swell{radius=4} # Priority 3 with parameters
Examples
Passive Mob
AIGoals:
- float
- randomstroll{speed=0.6}
- lookatplayer
Hostile Mob
AIGoals:
- float
- meleeattack{speed=1.2}
- randomstroll
- lookatplayer
AITargets:
- nearestplayer
Neutral Mob
AIGoals:
- float
- meleeattack
- randomstroll
- lookatplayer
AITargets:
- hurtbytarget
Cowardly Mob
AIGoals:
- float
- panic{speed=1.5}
- avoidentity{distance=8}
- randomstroll{speed=0.4}
- lookatplayer
Undead Mob (Sun Avoidance)
AIGoals:
- float
- restrictsun
- fleesun{speed=1.2}
- meleeattack{speed=1.0}
- randomstroll
AITargets:
- nearestplayer
Creeper-like Mob (Explodes)
AIGoals:
- 0 float
- 1 swell{radius=3, fuse=30}
- 3 meleeattack{speed=1.0}
- 5 wateravoidingrandomstroll{speed=0.8}
- 6 lookatplayer
AITargets:
- 1 nearestplayer
- 2 hurtbytarget
Skeleton-like Archer
AIGoals:
- 0 float
- 1 restrictsun
- 3 fleesun{speed=1.0}
- 4 rangedbowattack{attackInterval=20, attackRadius=15}
- 6 wateravoidingrandomstroll{speed=1.0}
- 7 lookatplayer
AITargets:
- 1 hurtbytarget
- 2 nearestplayer
Traits:
- sunburn
Equipment:
mainhand: minecraft:bow
Pouncing Predator
AIGoals:
- float
- leapattarget{leapheight=0.5}
- meleeattack{speed=1.3}
- randomstroll
- lookatplayer
AITargets:
- nearestattackable{targettype=animal}
Tameable Pet
Taming:
enabled: true
item: bone
AIGoals:
- float
- sitwhenordered
- followowner{speed=1.0, teleportdistance=12}
- meleeattack{speed=1.5}
- randomstroll
AITargets:
- ownerhurtby
- ownerhurt
Aquatic Mob
AIGoals:
- breathair
- tryfindwater
- randomswim{speed=1.2}
Farm Animal
AIGoals:
- float
- panic{speed=1.3}
- tempt{items=wheat;carrot, canscare=true}
- wateravoidingrandomstroll{speed=0.6}
- lookaround
Witch-like Potion Thrower
AIGoals:
- float
- rangedattack{projectile=splash_potion, potion=poison, attackInterval=60}
- wateravoidingrandomstroll
- lookatplayer
AITargets:
- nearestplayer
Blaze-like Fire Mage
AIGoals:
- float
- rangedattack{projectile=small_fireball, attackInterval=40, attackRadius=16}
- wateravoidingrandomstroll
- lookatplayer
AITargets:
- nearestplayer
- hurtbytarget
Traits:
- fireimmune
Snow Golem Clone
AIGoals:
- float
- rangedattack{projectile=snowball, attackInterval=20}
- wateravoidingrandomstroll
AITargets:
- nearestattackable{targettype=monster}
Trident-Throwing Guardian
AIGoals:
- float
- rangedattack{projectile=trident, attackInterval=50, attackRadius=20}
- randomswim
AITargets:
- nearestplayer
Traits:
- waterbreathing