{
  "$id": "blockception.minecraft.behavior.entities.minecraft.behavior.nearest_attackable_target",
  "type": "object",
  "title": "Nearest Attackable Target",
  "description": "Allows an entity to attack the closest target within a given subset of specific target types.",
  "additionalProperties": false,
  "definitions": {
    "entity_type": {
      "type": "object",
      "description": "A entity type.",
      "properties": {
        "filters": {
          "$ref": "../../filters/filters.json",
          "description": "Conditions that make this target a valid type.",
          "title": "Filters"
        },
        "max_dist": {
          "type": "number",
          "default": 16,
          "description": "To be a valid target choice, the target type cannot be farther away from this entity than `max_dist`.",
          "title": "Maximum Dist"
        },
        "must_see": {
          "type": "boolean",
          "default": false,
          "description": "Determines if target-validity requires this entity to be in range only, or both in range and in sight.",
          "title": "Must See"
        },
        "must_see_forget_duration": {
          "type": "boolean",
          "default": 3,
          "description": "Time (in seconds) the target must not be seen by this entity to become invalid. Used only if `must_see` is true.",
          "title": "Must See Forget Duration"
        }
      }
    }
  },
  "properties": {
    "priority": {
      "$ref": "./types/priority.json"
    },
    "entity_types": {
      "$ref": "../types/entity_types.json",
      "description": "Filters which types of targets are valid for this entity",
      "title": "Entity Types"
    },
    "attack_interval": {
      "type": "integer",
      "default": 0,
      "description": "Time range (in seconds) between searching for an attack target, range is in (0, `attack_interval`]. Only used if `attack_interval` is greater than 0, otherwise `scan_interval` is used.",
      "title": "Attack Interval"
    },
    "attack_interval_min": {
      "type": "number",
      "default": 0,
      "description": "Alias for `attack_interval`; provides the same functionality as `attack_interval`.",
      "title": "Attack Interval Min"
    },
    "attack_owner": {
      "type": "boolean",
      "default": false,
      "description": "If true, this entity can attack its owner.",
      "title": "Attack Owner"
    },
    "must_reach": {
      "type": "boolean",
      "default": false,
      "description": "If true, this entity requires a path to the target.",
      "title": "Must Reach"
    },
    "must_see": {
      "type": "boolean",
      "default": false,
      "description": "Determines if target-validity requires this entity to be in range only, or both in range and in sight.",
      "title": "Must See"
    },
    "must_see_forget_duration": {
      "type": "number",
      "default": 3,
      "description": "Time (in seconds) the target must not be seen by this entity to become invalid. Used only if `must_see` is true.",
      "title": "Must See Forget Duration"
    },
    "persist_time": {
      "type": "number",
      "default": 0,
      "description": "Time (in seconds) this entity can continue attacking the target after the target is no longer valid.",
      "title": "Persist Time"
    },
    "reselect_targets": {
      "type": "boolean",
      "default": false,
      "description": "Allows the attacking entity to update the nearest target, otherwise a target is only reselected after each `scan_interval` or `attack_interval`.",
      "title": "Reselect Targets"
    },
    "scan_interval": {
      "type": "integer",
      "default": 10,
      "description": "If `attack_interval` is 0 or isn't declared, then between attacks: scanning for a new target occurs every amount of ticks equal to `scan_interval`, minimum value is 1. Values under 10 can affect performance.",
      "title": "Scan Interval"
    },
    "set_persistent": {
      "type": "boolean",
      "default": false,
      "description": "Allows the actor to be set to persist upon targeting a player.",
      "title": "Set Persistent"
    },
    "target_invisible_multiplier": {
      "type": "number",
      "default": 0.7,
      "description": "Multiplied with the target's armor coverage percentage to modify `max_dist` when detecting an invisible target.",
      "title": "Target Invisible Multiplier"
    },
    "target_search_height": {
      "type": "number",
      "default": -1,
      "description": "Maximum vertical target-search distance, if it's greater than the target type's `max_dist`. A negative value defaults to `entity_types` greatest `max_dist`.",
      "title": "Target Search Height"
    },
    "target_sneak_visibility_multiplier": {
      "type": "number",
      "default": 0.8,
      "description": "Multiplied with the target type's `max_dist` when trying to detect a sneaking target.",
      "title": "Target Sneak Visibility Multiplier"
    },
    "within_radius": {
      "type": "number",
      "default": 0,
      "description": "Maximum 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`.",
      "title": "Within Radius"
    }
  },
  "examples": [
    {
      "attack_interval": 0,
      "attack_interval_min": 0,
      "attack_owner": false,
      "must_reach": false,
      "must_see": false,
      "must_see_forget_duration": 3,
      "persist_time": 0,
      "reselect_targets": false,
      "scan_interval": 10,
      "set_persistent": false,
      "target_invisible_multiplier": 0.7,
      "target_search_height": -1,
      "target_sneak_visibility_multiplier": 0.8,
      "within_radius": 0
    }
  ]
}
