概览
minecraft:behavior.ocelotattack 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 豹猫和猫使用的潜行扑击攻击。生物会悄悄靠近目标,然后冲刺并扑上去。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
cooldown_time | number | 1 | 两次攻击之间的秒数。 |
x_max_rotation | number | 30 | 生物看向目标时最多能上下仰俯的角度(度)。 |
y_max_head_rotation | number | 30 | 生物看向目标时头部最多能左右转动的角度(度)。 |
max_distance | number | 15 | 只有目标比这个距离更近时,生物才使用这种攻击。 |
max_sneak_range | number | 15 | 在这个距离内,生物开始朝目标潜行。 |
max_sprint_range | number | 4 | 在这个距离内,生物开始冲刺。冲刺优先于潜行。 |
reach_multiplier | number | 2 | 与生物体型相乘,决定它要离多近才能击中。 |
sneak_speed_multiplier | number | 0.6 | 潜行时的速度倍率。 |
sprint_speed_multiplier | number | 1.33 | 冲刺时的速度倍率。 |
walk_speed_multiplier | number | 0.8 | 在攻击范围内既不潜行也不冲刺、正常行走时的速度倍率。 |
priority | integer | 0 | 多个目标同时想运行时决定谁优先:数字越小越先运行。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 列出这个目标要控制的身体部分(比如移动、看向或跳跃),这样需要同一部分的目标就不会同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.ocelotattack": {
"cooldown_time": 1,
"x_max_rotation": 30,
"y_max_head_rotation": 30,
"max_distance": 15,
"max_sneak_range": 15,
"max_sprint_range": 4,
"reach_multiplier": 2,
"sneak_speed_multiplier": 0.6
}
}