Edit

Share via


Entity Documentation - minecraft:behavior.hurt_by_target

Allows the mob to target another mob that hurts them.

Hurt By Target Behavior Properties

Name Default Value Type Description Example Values
alert_same_type false Boolean true/false If true, nearby mobs of the same type will be alerted about the damage Silverfish: true
entity_types not set Array of Entity Types items List of entity types that this mob can target when hurt by them Bogged: [{"filters":{"test":"is_family","subject":"other","operator":"!=","value":"breeze"}}], Breeze: [{"filters":{"all_of":[{"test":"is_family","subject":"other","operator":"!=","value":"skeleton"},{"test":"is_family","subject":"other","operator":"!=","value":"stray"},{"test":"is_family","subject":"other","operator":"!=","value":"zombie"},{"test":"is_family","subject":"other","operator":"!=","value":"husk"},{"test":"is_family","subject":"other","operator":"!=","value":"spider"},{"test":"is_family","subject":"other","operator":"!=","value":"cavespider"},{"test":"is_family","subject":"other","operator":"!=","value":"slime"}]}}]
hurt_owner false Boolean true/false If true, the mob will hurt its owner and other mobs with the same owner as itself
priority not set Integer number As priority approaches 0, the priority is increased. The higher the priority, the sooner this behavior will be executed as a goal.

Entity Types item type

List of entity types that this mob can target when hurt by them.

Entity Types Properties

Name Default Value Type Description Example Values
cooldown 0 Decimal number The amount of time in seconds that the mob has to wait before selecting a target of the same type again
filters not set Minecraft filter Conditions that make this entry in the list valid
max_dist 16 Decimal number Maximum distance this mob can be away to be a valid choice
must_see false Boolean true/false If true, the mob has to be visible to be a valid choice
must_see_forget_duration 3 Decimal number 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
reevaluate_description false Boolean true/false If true, the mob will stop being targeted if it stops meeting any conditions.
sprint_speed_multiplier 1 Decimal number Multiplier for the running speed. A value of 1.0 means the speed is unchanged
walk_speed_multiplier 1 Decimal number Multiplier for the walking speed. A value of 1.0 means the speed is unchanged

Samples

Bee

"minecraft:behavior.hurt_by_target": {
  "priority": 1
}

Bogged

"minecraft:behavior.hurt_by_target": {
  "priority": 1,
  "entity_types": [
    {
      "filters": {
        "test": "is_family",
        "subject": "other",
        "operator": "!=",
        "value": "breeze"
      }
    }
  ]
}

Breeze

"minecraft:behavior.hurt_by_target": {
  "priority": 4,
  "entity_types": [
    {
      "filters": {
        "all_of": [
          {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "skeleton"
          },
          {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "stray"
          },
          {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "zombie"
          },
          {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "husk"
          },
          {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "spider"
          },
          {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "cavespider"
          },
          {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "slime"
          }
        ]
      }
    }
  ]
}

Creeper

"minecraft:behavior.hurt_by_target": {
  "priority": 2
}

Enderman

"minecraft:behavior.hurt_by_target": {
  "priority": 3
}

Evocation Illager

"minecraft:behavior.hurt_by_target": {
  "priority": 1,
  "entity_types": {
    "filters": {
      "test": "is_family",
      "subject": "other",
      "operator": "!=",
      "value": "illager"
    },
    "max_dist": 64
  }
}

Llama

"minecraft:behavior.hurt_by_target": {
  "priority": 1,
  "hurt_owner": true
}

Ravager

"minecraft:behavior.hurt_by_target": {
  "priority": 2,
  "entity_types": {
    "filters": {
      "test": "is_family",
      "subject": "other",
      "operator": "!=",
      "value": "illager"
    },
    "max_dist": 64
  }
}

Shulker

"minecraft:behavior.hurt_by_target": {
  "priority": 2,
  "entity_types": {
    "filters": {
      "test": "is_family",
      "subject": "other",
      "operator": "!=",
      "value": "shulker"
    }
  }
}

Silverfish

"minecraft:behavior.hurt_by_target": {
  "priority": 1,
  "alert_same_type": true
}

Trader Llama

"minecraft:behavior.hurt_by_target": {
  "priority": 1,
  "hurt_owner": true,
  "entity_types": {
    "filters": {
      "test": "is_family",
      "subject": "other",
      "operator": "!=",
      "value": "trader_llama"
    }
  }
}

Axe Turret

"minecraft:behavior.hurt_by_target": {
  "priority": 3,
  "entity_types": {
    "filters": {
      "test": "is_family",
      "subject": "other",
      "value": "monster"
    },
    "max_dist": 16
  }
}