1. Wiki
  2. /Entities
  3. /minecraft:on_hurt

minecraft:on_hurt

Don't want to write this by hand? GodCraft sets minecraft:on_hurt for you with a switch.Get GodCraft

Overview

minecraft:on_hurt is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Runs an event every time this entity takes damage.

Fields

FieldTypeDefaultDescription
eventstring""Name of the event to run.
targetFilterSubject"self"Who the event runs on, for example self or other.
filtersFilter Group{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null}Conditions that must be true for the event to run.

Example

Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):

BP/entities/<name>.json
{
  "minecraft:on_hurt": {
    "event": "",
    "target": "self",
    "filters": {
      "AND": null,
      "NOT": null,
      "OR": null,
      "all": null,
      "all_of": null,
      "any": null,
      "any_of": null,
      "none_of": null
    }
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more