minecraft:hurt_on_condition

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 Snow Golem uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:hurt_on_condition": {
    "damage_conditions": [
      {
        "cause": "lava",
        "damage_per_tick": 4,
        "filters": {
          "operator": "==",
          "test": "in_lava",
          "subject": "self",
          "value": true
        }
      },
      {
        "cause": "temperature",
        "damage_per_tick": 1,
        "filters": {
          "all_of": [
            {
              "operator": ">",
              "test": "is_temperature_value",
              "value": 1.0
            },
            {
              "operator": "!=",
              "test": "has_component",
              "subject": "self",
              "value": "minecraft:effect.fire_resistance"
            }
          ]
        }
      },
      {
        "cause": "drowning",
        "damage_per_tick": 1,
        "filters": {
          "operator": "==",
          "test": "in_contact_with_water",
          "value": true
        }
      }
    ]
  }
}

Used by 87

Vanilla entities with minecraft:hurt_on_condition in their definition:

Related components