Entity Documentation - minecraft:entity_sensor
minecraft:entity_sensor
is a component that owns multiple subsensors, with each firing an event when a set of conditions are met by other entities within the defined range.
Parameters
Name | Default Value | Type | Description |
---|---|---|---|
cooldown | -1 | Decimal | 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. |
event_filters | not set | Minecraft Filter | The set of conditions that must be satisfied to initiate the event. |
event | not set | String | Event to initiate when the conditions are met. |
maximum_count | -1 | Integer | The maximum number of entities that must pass the filter conditions for the event to send. |
minimum_count | 1 | Integer | The minimum number of entities that must pass the filter conditions for the event to send. |
range | [10, 10] | Vector [a, b] | The maximum horizontal and vertical distance another entity can be from this and have the filters checked against it. |
require_all | False | Boolean | If true, requires all nearby entities to pass the filter conditions for the event to send. |
subsensors | -- | List | The list of subsensors which sense for entities and emit events when all conditions are met. |
Example
"minecraft:entity_sensor":{
"maximum_count": -1,
"minimum_count": 1,
"cooldown": -1,
"require_all": false,
"range": 10,
"event_filters": {"test": "has_trade_supply"},
"event": "minecraft:offer_trade"
}
Vanilla entities examples
pufferfish
"minecraft:entity_sensor": {
"sensor_range": 2.5,
"relative_range": false,
"minimum_count": 1,
"event_filters": {
"any_of": [
{ "test": "is_family", "subject": "other", "value": "mob" },
{ "all_of": [
{ "test": "is_family", "subject": "other", "value": "player" },
{ "none_of":
{ "test": "has_ability", "subject": "other", "value": "instabuild" }
}
]}
]
},
"event": "minecraft:start_half_puff"
}
Vanilla entities using minecraft:entity_sensor
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for