Entity Documentation - minecraft:hurt_on_condition

minecraft:hurt_on_condition defines a set of conditions under which an entity should take damage.

Parameters

Name Default Value Type Description
damage_conditions not set Array List of damage conditions that, when met, can cause damage to the entity.

damage_conditions

damage_conditions is an array defined by three parameters. Each item has the following properties:

Name Default Value Type Description
filters not set Minecraft Filter Filter used to test for
cause not set String The kind of damage that is caused to the entity. Various armors and spells use this to determine if the entity is immune.
damage_per_tick not set Integer Amount of damage done each tick that the conditions are met.

cause

Important

A list of available damage sources can be found at Entity Damage Source located in the Addons Documentation.

Example

"minecraft:hurt_on_condition":{
    "damage_conditions": [
        {
            "filters": {"test": "in_water", "subject": "self", "operator": "==", "value": true},
            "cause": "drowning",
            "damage_per_tick": 1
        }
    ]
}

Vanilla entities examples

chicken

"minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      }

Vanilla entities using minecraft:hurt_on_condition