Skip to main content

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.

ParameterTypeDefaultDescription
---No parameters

Priority: 0

- float

panic

Makes the entity flee when hurt.

ParameterTypeDefaultDescription
speeddouble1.25Movement speed while fleeing

Priority: 1

- panic
- panic{speed=1.5}

meleeattack

Performs melee attacks on the current target.

ParameterTypeDefaultDescription
speeddouble1.0Chase speed
alwaysfollowbooleanfalseFollow through walls

Priority: 2

- meleeattack
- meleeattack{speed=1.2, alwaysfollow=true}
note

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).

ParameterTypeDefaultDescription
speeddouble0.8Wander speed

Priority: 7

- randomstroll
- randomstroll{speed=0.5}

lookatplayer

Looks at nearby players.

ParameterTypeDefaultDescription
rangedouble8.0Look range in blocks

Priority: 8

- lookatplayer
- lookatplayer{range=12.0}

Combat Goals

leapattarget

Leaps at the current target (like spiders and wolves).

ParameterTypeDefaultDescription
leapheightfloat0.4Vertical velocity of the leap

Priority: 4

- leapattarget
- leapattarget{leapheight=0.5}

movetowardstarget

Approaches the current target aggressively (like iron golems).

ParameterTypeDefaultDescription
speeddouble0.9Movement speed
withinfloat32.0Maximum distance to start approaching

Priority: 2

- movetowardstarget
- movetowardstarget{speed=1.0, within=16}

avoidentity

Flees from specified entity types (for cowardly mobs).

ParameterTypeDefaultDescription
targetstringplayerEntity type to avoid (e.g., player, wolf, cat, ocelot)
distancefloat6.0Distance to maintain from target
walkSpeeddouble1.0Walking speed when avoiding
sprintSpeeddouble1.2Sprint 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}
tip

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.

ParameterTypeDefaultDescription
radiusint3Explosion radius in blocks
fuseint30Ticks before explosion (1.5 seconds default)
poweredbooleanfalseWhether explosion is powered (2x radius)

Priority: 1

- swell
- swell{radius=4, fuse=40}
- swell{radius=3, fuse=30, powered=true}
tip

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.).

ParameterTypeDefaultDescription
projectilestringsnowballProjectile type (see below)
potionstringharmingPotion effect (for splash/lingering potions)
attackIntervalint60Ticks between attacks
attackRadiusdouble15.0Maximum attack range
speeddouble1.0Movement speed when chasing

Projectile Types:

ProjectileDescription
snowballSnow golem style (default)
eggThrown eggs
small_fireballBlaze-style fireball
fireballGhast-style large fireball
splash_potionSplash potion with effect
lingering_potionLingering potion cloud
arrowShoots arrows
tridentThrows 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.

ParameterTypeDefaultDescription
speeddouble1.0Movement speed
attackIntervalint20Ticks between shots
attackRadiusfloat15.0Maximum attack range

Priority: 4

- rangedbowattack
- rangedbowattack{attackInterval=30, attackRadius=20}
note

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.

ParameterTypeDefaultDescription
speeddouble1.0Movement speed when fleeing

Priority: 2

- fleesun
- fleesun{speed=1.2}

restrictsun

Prevents pathfinding through sunlit areas.

ParameterTypeDefaultDescription
---No parameters

Priority: 0

- restrictsun
tip

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.

ParameterTypeDefaultDescription
---No parameters

Priority: 1

- sitwhenordered

followowner

Makes tamed pets follow their owner, with teleportation when too far.

ParameterTypeDefaultDescription
speeddouble1.0Movement speed
startdistancefloat10.0Distance to start following
stopdistancefloat2.0Distance to stop following
teleportdistancefloat12.0Distance 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.

ParameterTypeDefaultDescription
speeddouble1.0Movement speed when following
itemsstringwheatItems that tempt (semicolon-separated)
canscarebooleanfalseWhether 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).

ParameterTypeDefaultDescription
---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.

ParameterTypeDefaultDescription
breaktimeint240Ticks to break door (12 seconds default)

Priority: 1

- breakdoor
- breakdoor{breaktime=120}
Full Zombie-like Behavior

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.

ParameterTypeDefaultDescription
closedoorbooleantrueWhether to close door after passing

Priority: 5

- opendoor
- opendoor{closedoor=false}

Movement Goals

lookaround

Randomly looks around when idle.

ParameterTypeDefaultDescription
---No parameters

Priority: 9

- lookaround

followmob

Follows other nearby mobs.

ParameterTypeDefaultDescription
speeddouble1.0Movement speed
stopdistancefloat3.0Distance to stop following
areasizefloat7.0Search 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).

ParameterTypeDefaultDescription
speeddouble1.0Swimming speed
intervalint120Ticks between swim attempts

Priority: 4

- randomswim
- randomswim{speed=1.2, interval=80}

wateravoidingrandomstroll

Wanders randomly while avoiding water.

ParameterTypeDefaultDescription
speeddouble1.0Movement speed
probabilityfloat0.001Chance per tick to start wandering

Priority: 6

- wateravoidingrandomstroll
- wateravoidingrandomstroll{speed=0.8, probability=0.002}

wateravoidingrandomflying

Flies randomly while avoiding water (for flying mobs).

ParameterTypeDefaultDescription
speeddouble1.0Flying speed

Priority: 6

- wateravoidingrandomflying
- wateravoidingrandomflying{speed=1.5}

breathair

Surfaces periodically to breathe (like dolphins).

ParameterTypeDefaultDescription
---No parameters

Priority: 0

- breathair

tryfindwater

Seeks water when on land (for aquatic mobs).

ParameterTypeDefaultDescription
---No parameters

Priority: 1

- tryfindwater

climbpowdersnow

Climbs on top of powder snow (like goats).

ParameterTypeDefaultDescription
---No parameters

Priority: 1

- climbpowdersnow

Priority System

Goals execute based on priority (lower number = higher priority):

PriorityGoal
0float, breathair, restrictsun
1panic, sitwhenordered, avoidentity, breakdoor, tryfindwater, climbpowdersnow, swell
2meleeattack, movetowardstarget, fleesun
3tempt
4leapattarget, randomswim, rangedattack, rangedbowattack
5eatblock, opendoor
6followowner, followmob, wateravoidingrandomstroll, wateravoidingrandomflying
7randomstroll
8lookatplayer
9lookaround

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