{
  "fields": [
    {
      "id": "inside_range",
      "title": "Inside Range",
      "description": "Maximum distance in blocks that another entity will be considered in the 'inside' range",
      "defaultValue": 1,
      "dataType": 3,
      "samples": {
        "/vanilla/behavior_pack/entities/blaze.json": [
          {
            "path": "/minecraft:entity/component_groups/mode_switcher/minecraft:target_nearby_sensor/",
            "content": 2
          }
        ],
        "/vanilla/behavior_pack/entities/drowned.json": [
          {
            "path": "/minecraft:entity/component_groups/minecraft:mode_switcher/minecraft:target_nearby_sensor/",
            "content": 3
          }
        ]
      }
    },
    {
      "id": "must_see",
      "title": "Must See",
      "description": "Whether the other entity needs to be visible to trigger 'inside' events",
      "defaultValue": false,
      "dataType": 1,
      "samples": {
        "/vanilla/behavior_pack/entities/blaze.json": [
          {
            "path": "/minecraft:entity/component_groups/mode_switcher/minecraft:target_nearby_sensor/",
            "content": true
          }
        ]
      }
    },
    {
      "id": "on_inside_range",
      "title": "On Inside Range",
      "description": "Event to call when an entity gets in the inside range. Can specify 'event' for the name of the event and 'target' for the target of the event",
      "dataType": 22,
      "samples": {
        "/vanilla/behavior_pack/entities/blaze.json": [
          {
            "path": "/minecraft:entity/component_groups/mode_switcher/minecraft:target_nearby_sensor/",
            "content": {
              "event": "switch_to_melee",
              "target": "self"
            }
          }
        ],
        "/vanilla/behavior_pack/entities/drowned.json": [
          {
            "path": "/minecraft:entity/component_groups/minecraft:mode_switcher/minecraft:target_nearby_sensor/",
            "content": {
              "event": "minecraft:switch_to_melee",
              "target": "self"
            }
          }
        ]
      }
    },
    {
      "id": "on_outside_range",
      "title": "On Outside Range",
      "description": "Event to call when an entity gets in the outside range. Can specify 'event' for the name of the event and 'target' for the target of the event",
      "dataType": 22,
      "samples": {
        "/vanilla/behavior_pack/entities/blaze.json": [
          {
            "path": "/minecraft:entity/component_groups/mode_switcher/minecraft:target_nearby_sensor/",
            "content": {
              "event": "switch_to_ranged",
              "target": "self"
            }
          }
        ],
        "/vanilla/behavior_pack/entities/drowned.json": [
          {
            "path": "/minecraft:entity/component_groups/minecraft:mode_switcher/minecraft:target_nearby_sensor/",
            "content": {
              "event": "minecraft:switch_to_ranged",
              "target": "self"
            }
          }
        ]
      }
    },
    {
      "id": "on_vision_lost_inside_range",
      "title": "On Vision Lost Inside Range",
      "description": "Event to call when an entity exits visual range. Can specify 'event' for the name of the event and 'target' for the target of the event",
      "dataType": 22
    },
    {
      "id": "outside_range",
      "title": "Outside Range",
      "description": "Maximum distance in blocks that another entity will be considered in the 'outside' range",
      "defaultValue": 5,
      "dataType": 3,
      "samples": {
        "/vanilla/behavior_pack/entities/blaze.json": [
          {
            "path": "/minecraft:entity/component_groups/mode_switcher/minecraft:target_nearby_sensor/",
            "content": 3
          }
        ],
        "/vanilla/behavior_pack/entities/drowned.json": [
          {
            "path": "/minecraft:entity/component_groups/minecraft:mode_switcher/minecraft:target_nearby_sensor/",
            "content": 5
          }
        ]
      }
    }
  ],
  "description": "Defines the entity's range within which it can see or sense other entities to target them.",
  "title": "Target Nearby Sensor",
  "samples": {
    "/vanilla/behavior_pack/entities/blaze.json": [
      {
        "path": "/minecraft:entity/component_groups/mode_switcher/minecraft:target_nearby_sensor/",
        "content": {
          "inside_range": 2,
          "outside_range": 3,
          "must_see": true,
          "on_inside_range": {
            "event": "switch_to_melee",
            "target": "self"
          },
          "on_outside_range": {
            "event": "switch_to_ranged",
            "target": "self"
          }
        }
      }
    ],
    "/vanilla/behavior_pack/entities/drowned.json": [
      {
        "path": "/minecraft:entity/component_groups/minecraft:mode_switcher/minecraft:target_nearby_sensor/",
        "content": {
          "inside_range": 3,
          "outside_range": 5,
          "on_inside_range": {
            "event": "minecraft:switch_to_melee",
            "target": "self"
          },
          "on_outside_range": {
            "event": "minecraft:switch_to_ranged",
            "target": "self"
          }
        }
      }
    ]
  },
  "id": "minecraft:target_nearby_sensor"
}