概览
minecraft:on_hurt_by_player 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 玩家攻击这个实体时运行一个事件。适合只在被玩家打了之后才变得敌对的生物。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
event | string | "" | 要运行的事件名称。 |
target | FilterSubject | "self" | 事件作用于谁,比如 self 或 other。 |
filters | Filter 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_by_player": {
"event": "",
"target": "self",
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
}
}
}