A component that owns multiple subsensors, each one firing an event when a set of conditions are met by other entities within the defined range.
Entity Sensor Properties
| Name | Default Value | Type | Description | Example Values |
|---|---|---|---|---|
| find_players_only | false | Boolean true/false | Limits the search to Players only for all subsensors. | |
| relative_range | true | Boolean true/false | If true the subsensors' range is additive on top of the entity's size. | |
| subsensors | not set | Array of Subsensors items | The list of subsensors which sense for entities and emit events when all their conditions are met. | Parrot: [{"event":"minecraft:on_riding_player","event_filters":{"all_of":[{"test":"is_riding","operator":"equals","subject":"self","value":true},{"test":"has_component","operator":"equals","subject":"self","value":"minecraft:behavior.look_at_player"}]},"range":[2,2]}], [{"event":"minecraft:on_not_riding_player","event_filters":{"all_of":[{"test":"is_riding","operator":"equals","subject":"self","value":false},{"test":"has_component","operator":"not","subject":"self","value":"minecraft:behavior.look_at_player"}]},"range":[2,2]}] |
Subsensors
The list of subsensors which sense for entities and emit events when all their conditions are met.
Subsensors Properties
JSON path: subsensors
| Name | Default Value | Type | Description |
|---|---|---|---|
| cooldown | -1 | Decimal number | How many seconds should elapse before the subsensor can once again sense for entities. |
| event | not set | Minecraft Event Trigger | Event to fire when the conditions are met. |
| event_filters | not set | Minecraft filter | The set of conditions that must be satisfied to fire the event. |
| maximum_count | -1 | Integer number | The maximum number of entities that must pass the filter conditions for the event to send. |
| minimum_count | 1 | Integer number | The minimum number of entities that must pass the filter conditions for the event to send. |
| range | [10, 10] | a, b coordinate array | The maximum horizontal and vertical distance another entity can be from this and have the filters checked against it. |
| require_all | false | Boolean true/false | If true requires all nearby entities to pass the filter conditions for the events to send. |
| y_offset | 0 | Decimal number | Vertical offset applied to the entity's position when computing the distance from other entities. |
cooldown
How many seconds should elapse before the subsensor can once again sense for entities. The cooldown is applied on top of the base 1 tick (0.05 seconds) delay. Negative values will result in no cooldown being used.
Samples
Parrot
At /minecraft:entity/component_groups/minecraft:parrot_not_riding_player/minecraft:entity_sensor/:
"minecraft:entity_sensor": {
"relative_range": false,
"subsensors": [
{
"event": "minecraft:on_riding_player",
"event_filters": {
"all_of": [
{
"test": "is_riding",
"operator": "equals",
"subject": "self",
"value": true
},
{
"test": "has_component",
"operator": "equals",
"subject": "self",
"value": "minecraft:behavior.look_at_player"
}
]
},
"range": [
2,
2
]
}
]
}
At /minecraft:entity/component_groups/minecraft:parrot_riding_player/minecraft:entity_sensor/:
"minecraft:entity_sensor": {
"relative_range": false,
"subsensors": [
{
"event": "minecraft:on_not_riding_player",
"event_filters": {
"all_of": [
{
"test": "is_riding",
"operator": "equals",
"subject": "self",
"value": false
},
{
"test": "has_component",
"operator": "not",
"subject": "self",
"value": "minecraft:behavior.look_at_player"
}
]
},
"range": [
2,
2
]
}
]
}