Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Defines the entity's range within which it can see or sense other entities to target them.
Target Nearby Sensor Properties
| Name | Default Value | Type | Description | Example Values |
|---|---|---|---|---|
| inside_range | 1 | Decimal number | Maximum distance in blocks that another entity will be considered in the 'inside' range | Blaze: 2, Drowned: 3 |
| must_see | false | Boolean true/false | Whether the other entity needs to be visible to trigger 'inside' events | Blaze: true |
| on_inside_range | not set | Object | Event to call when an entity gets in the inside range. Can be an object with event and target properties, or a simple event string. | Blaze: {"event":"switch_to_melee","target":"self"}, Drowned: {"event":"minecraft:switch_to_melee","target":"self"} |
| on_inside_range (as String) | not set | String | ||
| on_outside_range | not set | Object | Event to call when an entity gets outside the outside range. Can be an object with event and target properties, or a simple event string. | Blaze: {"event":"switch_to_ranged","target":"self"}, Drowned: {"event":"minecraft:switch_to_ranged","target":"self"} |
| on_outside_range (as String) | not set | String | ||
| on_vision_lost_inside_range | not set | Minecraft Event Trigger | 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 | |
| outside_range | 5 | Decimal number | Maximum distance in blocks that another entity will be considered in the 'outside' range | Blaze: 3, Drowned: 5 |
Samples
Blaze
"minecraft:target_nearby_sensor": {
"on_inside_range": {
"event": "switch_to_melee",
"target": "self"
},
"inside_range": 2,
"must_see": true,
"outside_range": 3,
"on_outside_range": {
"event": "switch_to_ranged",
"target": "self"
}
}
Drowned
"minecraft:target_nearby_sensor": {
"inside_range": 3,
"on_inside_range": {
"event": "minecraft:switch_to_melee",
"target": "self"
},
"on_outside_range": {
"event": "minecraft:switch_to_ranged",
"target": "self"
},
"outside_range": 5
}