minecraft:block_sensor for you with a switch.Get GodCraftOverview
minecraft:block_sensor is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Fires an event when one of the listed blocks is broken near the entity. Piglins use it to get angry when someone breaks gold blocks or chests.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
on_break | List | none | Lists of blocks to watch, each with the event to fire when one breaks. A block in several lists fires several events. |
sensor_radius | Decimal | "16.00" | How far away a broken block can be noticed. The largest allowed value is 32. |
sources | List | none | Which breakers to listen for, using filters. If empty, any block break counts. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:block_sensor": {
"on_break": {},
"sensor_radius": "16.00",
"sources": {}
}
}