概览
minecraft:behavior.panic 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物慌张地四处乱跑,远离伤害它的东西。牛和鸡等动物被打时会用到它。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
damage_sources | List | "[campfire, fire, fire_tick, freezing, lava, lightning, magma, soul_campfire, temperature, entity_attack, entity_explosion, fireworks, magic, projectile, ram_attack, sonic_boom, wither, mace_smash]" | 哪些伤害类型会让生物惊慌,比如 "fire" 或 "entity_attack"。 |
force | Boolean | "false" | 设为 true 时,生物会一直惊慌,直到无法移动或这个目标被移除。 |
ignore_mob_damage | Boolean | "false" | 设为 true 时,来自其他生物的伤害永远不会引起惊慌,即使它列在 damage_sources 中。 |
prefer_water | Boolean | "false" | 设为 true 时,惊慌的生物会尽量往水边跑。 |
speed_multiplier | Decimal | "1.0" | 这个目标运行时让生物加速或减速:1 为正常速度。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.panic": {
"damage_sources": "[campfire, fire, fire_tick, freezing, lava, lightning, magma, soul_campfire, temperature, entity_attack, entity_explosion, fireworks, magic, projectile, ram_attack, sonic_boom, wither, mace_smash]",
"force": "false",
"ignore_mob_damage": "false",
"prefer_water": "false",
"speed_multiplier": "1.0"
}
}