Entity Documentation - has_damage

Returns true when the subject entity receives the named damage type.

Parameters

Name Default Value Type Description
value not set String The Damage type to test

List of Damage Types

Below is a list of damage types that can be used for the value string.

Options Description
anvil
attack
block_explosion
contact
drowning
entity_explosion
fall
falling_block
fatal Any damage which kills the subject
fire
fire_tick
fly_into_wall
lava
magic
none
override
piston
projectile
self_destruct
sonic_boom
stalactite
stalagmite
starve
suffocation
thorns
void
wither

Note

has_damage can also use subject and operator parameters but they are optional.

subject

Options Description
block The block involved with the interaction.
damager The damaging entity involved with the interaction.
other The other member of an interaction, not the caller.
parent The caller's current parent.
player The player involved with the interaction.
self The entity or object calling the test
target The caller's current target.

operator

Options Description
!= Test for inequality.
< Test for less-than the value.
<= Test for less-than or equal to the value.
<> Test for inequality.
= Test for equality.
== Test for equality.
> Test for greater-than the value.
>= Test for greater-than or equal to the value.
equals Test for equality.
not Test for inequality.

Example

Full

{ "test": "has_damage", "subject": "self", "operator": "equals", "value": "fatal" }

Short (using Defaults)

{ "test": "has_damage", "value": "fatal" }

Vanilla entities examples

pillager

{ "test": "has_damage", "value": "fatal" }

Vanilla entities using has_damage