概览
minecraft:behavior.play_dead 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物受伤后翻倒装死,让攻击者失去兴趣。美西螈会用它,并在装死时恢复生命。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
duration | number | 1 | 生物装死持续的时间(秒)。 |
random_start_chance | number | 1 | 受到伤害时开始装死的几率。 |
force_below_health | integer | 0 | 生物生命值低于这个值时,任何伤害都会让它装死。 |
random_damage_range | IntRange | {"max":0,"min":0} | 低于最小值的伤害永远不会触发,高于最大值的伤害一定会触发,介于两者之间则随机。 |
damage_sources | ActorDamageCause[] | 无 | 哪些伤害类型可以让生物装死。 |
apply_regeneration | boolean | false | 设为 true 时,生物装死期间获得生命恢复效果。 |
filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | 生物装死必须额外满足的条件。 |
priority | integer | 0 | 多个目标同时想运行时决定谁优先:数字越小越先运行。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 列出这个目标要控制的身体部分(比如移动、看向或跳跃),这样需要同一部分的目标就不会同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.play_dead": {
"duration": 1,
"random_start_chance": 1,
"force_below_health": 0,
"random_damage_range": {
"max": 0,
"min": 0
},
"damage_sources": [],
"apply_regeneration": false,
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"priority": 0
}
}