1. Wiki
  2. /实体
  3. /minecraft:on_hurt

minecraft:on_hurt

不想手写?在 GodCraft 里打开一个开关,就能帮你设置好 minecraft:on_hurt。Get GodCraft

概览

minecraft:on_hurt 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 这个实体每次受到伤害时运行一个事件。

字段

字段类型默认值说明
eventstring""要运行的事件名称。
targetFilterSubject"self"事件作用于谁,比如 self 或 other。
filtersFilter Group{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null}事件运行必须满足的条件。

示例

写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):

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