Skip to main content

Entity AI goal reference (10/41)

This page carries the AI goal (behavior) pages of MS Learn (MicrosoftDocs/minecraft-creator a9fd1c0, CC BY 4.0). IDs, property names, types, default values and JSON are as in the original. The full list is in the index.

minecraft:behavior.defend_village_target​

(Source: ms-learn, creator/Reference/Content/EntityReference/Examples/EntityGoals/minecraftBehavior_defend_village_target.md)

Allows the entity to stay in a village and defend the village from aggressors. If a player is in bad standing with the village this goal will cause the entity to attack the player regardless of filter conditions.

[!Note] This behavior is typically used with the minecraft:dweller component which defines the entity's role in a village. See iron_golem.json for a complete example.

[!Note] In 1.26.0 the schema is stricter and rejects invalid JSON for this behavior.

Entity Defend Village Target Behavior Properties​

NameDefault ValueTypeDescriptionExample Values
attack_chance0.05000000074505806Decimal numberThe percentage chance that the entity has to attack aggressors of its village, where 1.0 = 100%. Value must be <= 1.
attack_ownerfalseBoolean true/falseIf true, this entity can attack its owner.
control_flags[]Control Flags choices
entity_types[]Array of objectsFilters which types of targets are valid for this entity.Iron Golem: [{"filters":{"AND":[{"OR":[{"test":"is_family","subject":1,"operator":0,"value":"mob"},{"test":"is_family","subject":1,"operator":0,"value":"player"}]}]}}]
entity_types (Entity Types)not setEntity Types (Entity Types) item
must_reachfalseBoolean true/falseIf true, this entity requires a path to the target.Iron Golem: true
must_seefalseBoolean true/falseDetermines if target-validity requires this entity to be in range only, or both in range and in sight.
must_see_forget_duration3Decimal numberTime (in seconds) the target must not be seen by this entity to become invalid. Used only if "must_see" is true.
persist_time0Decimal numberTime (in seconds) this entity can continue attacking the target after the target is no longer valid.
priority0Integer numberAs priority approaches 0, the priority is increased. The higher the priority, the sooner this behavior will be executed as a goal.Iron Golem: 1
within_radius0Decimal numberMaximum distance this entity can be from the target when following it, otherwise the target becomes invalid. This value is only used if the entity doesn't declare "minecraft:follow_range".

Control Flags choices​

ValueTitleDescription
jumpJump
lookLook
moveMove

Entity Types (Entity Types)​

Entity Types Properties​

JSON path: entity_types

NameDefault ValueTypeDescription
check_if_outnumberedfalseBoolean true/falseIf true, the mob will check if its outnumbered
cooldown0Integer numberThe amount of time in seconds that the mob has to wait before selecting a target of the same type again
filters (Filters){"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null}Filters itemConditions that make this entry in the list valid
filters (Alternate 1)not setObject
max_dist16Decimal numberMaximum distance this mob can be away to be a valid choice
max_flee10Decimal numberMaximum distance this mob can be from the target to stop fleeing
max_height-1Decimal numberMaximum height this mob can be away to be a valid choice
must_seenot setBoolean true/falseIf true, the mob has to be visible to be a valid choice
must_see_forget_duration3Integer numberDetermines the amount of time in seconds that this mob will look for a target before forgetting about it and looking for a new one when the target isn't visible any more
priority0Integer numberPriority for this mob type
reevaluate_descriptionfalseBoolean true/falseIf true, the mob will stop being targeted if it stops meeting any conditions.
sprint_speed_multiplier1Decimal numberMultiplier for the sprinting speed. A value of 1.0 means the speed is unchanged
walk_speed_multiplier1Decimal numberMultiplier for the walking speed. A value of 1.0 means the speed is unchanged
Filters​
Filters Properties​

JSON path: entity_types > filters

NameDefault ValueTypeDescription
domainnot setObjectThe domain the test should be performed in.
operatornot setObjectThe comparison to apply with 'value'.
subjectnot setObjectThe subject of this filter test.
testnot setStringThe name of the test to apply.
valuenot setObjectThe value being compared with the test.

Samples​

Iron Golem​
"minecraft:behavior.defend_village_target": {
"must_reach": true,
"entity_types": [
{
"filters": {
"AND": [
{
"OR": [
{
"test": "is_family",
"subject": 1,
"operator": 0,
"value": "mob"
},
{
"test": "is_family",
"subject": 1,
"operator": 0,
"value": "player"
}
]
}
]
}
}
],
"priority": 1
}
Sources
idSourceLicenseCommitAccessed
ms-learnMinecraft Creator documentation (Microsoft Learn)CC BY 4.0 (documentation), MIT (code)a9fd1c02026-11-13