minecraft:damage_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 Creaking uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:damage_sensor": {
    "triggers": [
      {
        "cause": "void",
        "deals_damage": "yes"
      },
      {
        "cause": "all",
        "on_damage": {
          "event": "minecraft:damaged_by_player",
          "filters": {
            "subject": "other",
            "test": "is_family",
            "value": "player"
          }
        },
        "deals_damage": "no_but_side_effects_apply"
      },
      {
        "cause": "all",
        "on_damage": {
          "event": "minecraft:damaged_by_entity",
          "filters": {
            "subject": "other",
            "test": "is_family",
            "value": "mob"
          }
        },
        "deals_damage": "no_but_side_effects_apply"
      },
      {
        "cause": "projectile",
        "on_damage": {
          "event": "minecraft:damaged_by_entity"
        },
        "deals_damage": "no_but_side_effects_apply"
      },
      {
        "cause": "all",
        "deals_damage": "no_but_side_effects_apply"
      }
    ]
  }
}

Used by 39

Vanilla entities with minecraft:damage_sensor in their definition:

Related components