|Name||entity damaged by entity|
<entity> damaged by <entity>
<entity> damaged (by <cause>)
<entity> damages <entity>
|Triggers||when an entity is damaged.|
on entity damaged:
- announce "A <context.entity.entity_type> took damage!"
on player damages cow:
- announce "<player.name> damaged a cow at <context.entity.location.simple>"
on player damages cow|sheep|chicken with:*_hoe:
- narrate "Whoa there farmer, you almost hurt your farm animals with that farmin' tool!"
- determine cancelled
on entity damaged type:minecart:
- announce "A minecart took non-vehicular damage!"
|Has Player||when the damager or damaged entity is a player. Cannot be both. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.|
|Has NPC||when the damager or damaged entity is an NPC. Cannot be both.|
|Switches||with:<item> to only process the event when the item used to cause damage (in the damager's hand) is a specified item.
type:<entity> to only run if the entity damaged matches the entity input.
block:<block-matcher> to only run if the damage came from a block that matches the given material or location matcher.
<context.entity> returns the EntityTag that was damaged.
<context.damager> returns the EntityTag damaging the other entity, if any.
<context.damager_block> returns the LocationTag of a block that damaged the entity, if any.
<context.cause> returns an ElementTag of reason the entity was damaged - see Language:damage cause for causes.
<context.damage> returns an ElementTag(Decimal) of the amount of damage dealt.
<context.final_damage> returns an ElementTag(Decimal) of the amount of damage dealt, after armor is calculated.
<context.projectile> returns a EntityTag of the projectile, if one caused the event.
<context.damage_type_map> returns a MapTag the damage dealt by a specific damage type with keys: BASE, HARD_HAT, BLOCKING, ARMOR, RESISTANCE, MAGIC, ABSORPTION.
<context.was_critical> returns 'true' if the damage was a critical hit. (Warning: this value is calculated and not guaranteed to be correct if the event is altered).
|Determine||ElementTag(Decimal) to set the amount of damage the entity receives.
"CLEAR_MODIFIERS" to zero out all damage modifiers other than "BASE", effectively making damage == final_damage.
|Cancellable||True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'|
|Has Location||True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...|