minecraft:behavior.defend_trusted_target
Allows the mob to target another mob that hurts an entity it trusts.
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
attack_interval | Integer | 0 | Time in seconds between attacks |
entity_types | List of object or Object | [] | List of entity types that this mob considers valid targets |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Conditions that make this entry in the list valid |
max_dist | Decimal | 16 | Maximum distance this mob can be away to be a valid choice |
max_height | Decimal | -1 | Maximum height this mob can be away to be a valid choice |
max_flee | Decimal | 10 | Maximum distance this mob can be from the target to stop fleeing |
walk_speed_multiplier | Decimal | 1 | Multiplier for the walking speed. A value of 1.0 means the speed is unchanged |
sprint_speed_multiplier | Decimal | 1 | Multiplier for the sprinting speed. A value of 1.0 means the speed is unchanged |
priority | Integer | 0 | Priority for this mob type |
check_if_outnumbered | Boolean | false | If true, the mob will check if its outnumbered |
reevaluate_description | Boolean | false | If true, the mob will stop being targeted if it stops meeting any conditions. |
cooldown | Integer | 0 | The amount of time in seconds that the mob has to wait before selecting a target of the same type again |
must_see | Boolean | — | If true, the mob has to be visible to be a valid choice |
must_see_forget_duration | Integer | 3 | Determines 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 |
within_radius | Decimal | 0 | Distance in blocks that the target can be within to launch an attack |
must_see | Boolean | false | If true, only entities in this mob's viewing range can be selected as targets |
must_see_forget_duration | Decimal | 3 | Determines 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 |
aggro_sound | Textitem.use.on, hit, step, step.baby, fly, jump, jump.prevent, break, place, heavy.step, gallop, fall, hurt, hurt.baby, hurt.in.water, death, death.baby, death.in.water, death.to.zombie, ambient, ambient.baby, ambient.in.water, ambient.in.air, ambient.tame … | "undefined" | Sound to occasionally play while defending. |
on_defend_start | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Trigger to be executed when defending begins. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Filters allow data objects to specify test criteria which allows their use. Filters can be defined by a single object of type (Filter Test), an array of tests, collection groups, or a combination of these objects. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
priority | Integermin 0 | 0 | |
control_flags | List of text | [] |
Example from the game files
This is how vanilla Fox uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:behavior.defend_trusted_target": {
"priority": 0,
"within_radius": 25,
"must_see": false,
"aggro_sound": "mad",
"on_defend_start": {
"event": "minecraft:fox_configure_defending",
"target": "self"
}
}
}Used by 1
Vanilla entities with minecraft:behavior.defend_trusted_target in their definition:
Related components
behavior.hurt_by_targetbehavior.follow_target_captainbehavior.defend_village_targetbehavior.jump_around_targetbehavior.look_at_targetbehavior.move_around_targetbehavior.move_towards_targetbehavior.owner_hurt_by_targetbehavior.owner_hurt_targetbehavior.stalk_and_pounce_on_targetbehavior.target_when_pushedbehavior.wither_target_highest_damagebehavior.follow_target_leaderbehavior.vex_copy_owner_target