AI Target Selectors
Target selectors determine what entities the mob will target for attack. They work alongside goal selectors to create intelligent mob behavior.Usage
Available Target Selectors
clear
Removes all default target selectors. Always use this first to prevent vanilla behavior from conflicting.hurtby / hurtbytarget / attacker
Target the entity that last damaged this mob. This is reactive - the mob won’t attack until provoked. Aliases:hurtby, hurtbytarget, attacker, damager
players / player
Actively target nearby players. The mob will seek out and attack players within range. Aliases:players, player, nearestplayer, nearestattackable, nearest
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
range | number | 16 | Detection range in blocks |
ignorelineofsight | boolean | false | If true, can target players through walls |
monsters / monster
Target nearby hostile mobs (zombies, skeletons, etc.)villagers / villager
Target nearby villagersirongolem / iron_golem
Target nearby iron golemsownerhurt
For tamed mobs: target whoever hurt the ownerownerhurtby
For tamed mobs: target whoever the owner is attackinganimals / animal
Target nearby passive animalsnearestcreature / nearestentity
Target the nearest living entity of any typePriority
Selectors are processed in order with auto-incrementing priority. Lower numbers = higher priority.Line of Sight
By default, mobs need line of sight to target entities. If your mob isn’t targeting players:- Ensure the mob has clear view to the player
- Or add
ignorelineofsight=trueto the selector