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
- armor_stand
- arrow
- axolotl
- bat
- bee
- blaze
- boat
- cat
- cave_spider
- chicken
- cow
- creeper
- dolphin
- donkey
- drowned
- elder_guardian
- enderman
- endermite
- evocation_illager
- fish
- glow_squid
- goat
- guardian
- hoglin
- hopper_minecart
- horse
- husk
- iron_golem
- llama
- mooshroom
- mule
- npc
- ocelot
- panda
- parrot
- phantom
- pig
- piglin_brute
- piglin
- pillager
- player
- polar_bear
- pufferfish
- rabbit
- ravager
- salmon
- sheep
- shulker_bullet
- shulker
- silverfish
- skeleton_horse
- skeleton
- slime
- snow_golem
- spider
- squid
- stray
- strider
- tripod_camera
- tropicalfish
- turtle
- villager_v2
- villager
- vindicator
- wandering_trader
- witch
- wolf
- zombie_horse
- zombie_villager_v2
- zombie_villager
- zombie
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for