minecraft:entity_sensor
Dynamic value
Properties
This component has no properties in the official schema: add it as an empty object {} to switch the behaviour on.
Example from the game files
This is how vanilla Armadillo uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:entity_sensor": {
"subsensors": [
{
"event": "minecraft:no_threat_detected",
"cooldown": 0.2,
"range": [
7.0,
2.0
],
"minimum_count": 0,
"maximum_count": 0,
"event_filters": {
"any_of": [
{
"test": "is_family",
"subject": "other",
"value": "undead"
},
{
"all_of": [
{
"test": "is_family",
"subject": "other",
"value": "player"
},
{
"any_of": [
{
"test": "was_last_hurt_by",
"subject": "other"
},
{
"test": "is_sprinting",
"subject": "other"
},
{
"test": "is_riding",
"subject": "other"
}
]
}
]
}
]
}
},
{
"event": "minecraft:threat_detected",
"cooldown": 0.2,
"range": [
7.0,
2.0
],
"minimum_count": 1,
"event_filters": {
"any_of": [
{
"test": "is_family",
"subject": "other",
"value": "undead"
},
{
"all_of": [
{
"test": "is_family",
"subject": "other",
"value": "player"
},
{
"any_of": [
{
"test": "was_last_hurt_by",
"subject": "other"
},
{
"test": "is_sprinting",
"subject": "other"
},
{
"test": "is_riding",
"subject": "other"
}
]
}
]
}
]
}
}
]
}
}Used by 4
Vanilla entities with minecraft:entity_sensor in their definition:
Related components
damage_sensorinteractenvironment_sensoron_target_acquiredtimeron_target_escapegame_event_movement_trackingrail_sensortarget_nearby_sensorbody_rotation_blockedon_friendly_angeron_hurtblock_sensorinside_block_notifierlooked_aton_hurt_by_playerschedulervibration_listenerbody_rotation_always_follows_headon_deathon_equipment_changedon_start_landingon_start_takeoffon_wake_with_owner