minecraft:on_target_acquired

Adds a trigger to call when this entity finds a target.

Properties

PropertyTypeDefaultWhat it does
eventText""
targetTextself, other, player, target, parent, baby, block, damager, holder, item"self"
filtersObject 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.
testText—The name of the test to apply.
subjectBoolean or Integer or Decimal or Text—The subject of this filter test.
operatorBoolean or Integer or Decimal or Text—The comparison to apply with 'value'.
domainBoolean or Integer or Decimal or Text—The domain the test should be performed in.
valueBoolean or Integer or Decimal or Text—The value being compared with the test.

Example from the game files

This is how vanilla Llama uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:on_target_acquired": {
    "filters": {
      "all_of": [
        {
          "test": "is_family",
          "subject": "target",
          "value": "wolf"
        },
        {
          "test": "has_component",
          "subject": "target",
          "operator": "!=",
          "value": "minecraft:is_tamed"
        }
      ]
    },
    "event": "minecraft:mad_at_wolf",
    "target": "self"
  }
}

Used by 22

Vanilla entities with minecraft:on_target_acquired in their definition:

Related components