AI Goal Selectors
Goal selectors define what behaviors a mob can perform. They control movement, attacks, and general activities.
Usage
AIGoalSelectors:
- clear # Remove vanilla goals
- meleeattack # Attack targets in melee
- randomstroll # Wander randomly
Available Goal Selectors
clear
Removes all default goal selectors. Always use this first to prevent vanilla behavior.
meleeattack
Approach and attack the current target in melee range.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
speed | number | 1.2 | Movement speed multiplier |
range | number | - | Attack range in blocks |
longmemory | boolean | true | Remember target location |
Example:
- meleeattack{speed=1.4;range=2.5}
randomstroll / randomwalk
Wander around randomly when not in combat.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
speed | number | 1.0 | Walk speed multiplier |
probability | float | 0.001 | Chance to start strolling per tick |
lookaround / randomlookaround
Randomly look around at the environment.
lookatplayers / lookplayers
Look at nearby players.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
range | number | 8 | Look detection range |
float
Swim upward in water to avoid drowning.
panic
Run away when damaged (for passive mobs).
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
speed | number | 1.25 | Panic movement speed |
leapattarget / leap
Leap at the target entity.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
velocity | float | 0.4 | Leap force |
fleesun / avoidsun
Seek shelter from sunlight (useful with PreventSunburn: true).
restrictsun
Avoid pathfinding into sunlight.
fleeplayers / avoidplayers
Run away from nearby players.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
range | number | 8 | Flee range |
speed | number | 1.0 | Walk speed when fleeing |
sprintspeed | number | 1.2 | Sprint speed when close |
breakdoors / breakdoor
Break through wooden doors (zombie behavior).
rangedattack / arrowattack
Attack targets with projectiles.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
speed | number | 1.0 | Movement speed |
range | number | 15 | Attack range |
interval | int | 20 | Ticks between shots |
followowner
Follow the owner (for tamed mobs).
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
speed | number | 1.0 | Follow speed |
startdistance | float | 10 | Start following at this distance |
stopdistance | float | 2 | Stop following at this distance |
Priority System
Goals are processed from lowest to highest priority. Explicit priorities can be set:
AIGoalSelectors:
- clear
- 0 float # Priority 0 (checked first)
- 1 meleeattack # Priority 1
- 2 randomstroll # Priority 2 (fallback behavior)
Example Configuration
SmartZombie:
Type: ZOMBIE
AIGoalSelectors:
- clear
- float # Don't drown
- meleeattack{speed=1.3} # Attack fast
- leapattarget{velocity=0.5} # Jump at target
- breakdoors # Break through doors
- randomstroll{speed=0.8} # Patrol when idle
- lookaround # Look around
AITargetSelectors:
- clear
- hurtby
- players