1. Wiki
  2. /Entities
  3. /minecraft:block_sensor

minecraft:block_sensor

Don't want to write this by hand? GodCraft sets minecraft:block_sensor for you with a switch.Get GodCraft

Overview

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

FieldTypeDefaultDescription
on_breakListnoneLists of blocks to watch, each with the event to fire when one breaks. A block in several lists fires several events.
sensor_radiusDecimal"16.00"How far away a broken block can be noticed. The largest allowed value is 32.
sourcesListnoneWhich 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": {}
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more