概览
minecraft:target_nearby_sensor 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 在两个距离上监测目标,当目标靠近、远离或离开视线时运行事件。苦力怕用它开始膨胀。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
inside_range | Decimal | "1" | 算作靠近的距离(以方块计)。 |
must_see | Boolean | "false" | 为 true 时,目标必须可见才会触发靠近事件。 |
on_inside_range | String | 无 | 目标进入近距离范围时运行的事件。 |
on_outside_range | String | 无 | 目标离开近距离范围但仍在外圈范围内时运行的事件。 |
on_vision_lost_inside_range | String | 无 | 近处的目标看不见时运行的事件。 |
outside_range | Decimal | "5" | 外圈范围的距离(以方块计)。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:target_nearby_sensor": {
"inside_range": "1",
"must_see": "false",
"on_inside_range": "",
"on_outside_range": "",
"on_vision_lost_inside_range": "",
"outside_range": "5"
}
}