1. Wiki
  2. /实体
  3. /minecraft:behavior.move_to_block

minecraft:behavior.move_to_block

不想手写?在 GodCraft 里打开一个开关,就能帮你设置好 minecraft:behavior.move_to_block。Get GodCraft

概览

minecraft:behavior.move_to_block 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让生物走到指定类型的方块,并在到达或停留一段时间后运行事件的 AI 目标。适合寻找花、床等的生物。

字段

字段类型默认值说明
speed_multipliernumber1走向方块时的速度倍率。
search_rangeinteger0生物在水平方向上寻找方块的范围(格)。
search_heightinteger1生物在上下方向上寻找方块的范围(格)。
tick_intervalinteger20大约每隔多少刻尝试开始一次此目标。
stay_durationnumber0生物需要在方块旁停留多少刻才算完成访问。
goal_radiusnumber0.5生物需要靠近到多近才算到达,可防止它在目标点附近来回抖动。
start_chancenumber1每次经过刻间隔时开始的几率。
target_selection_methodTarget Selection Method"nearest"如何选择方块:"random" 或 "nearest"。
target_offsetvec3[0,0,0]在所选方块位置上增加的 X、Y、Z 偏移。
on_reachActorDefinitionTrigger[]无生物到达方块时触发的事件。
on_stay_completedActorDefinitionTrigger[]无生物停留满 stay_duration 后触发的事件。
target_blocksItem Descriptor[]无生物要走去的方块类型。
target_block_filtersFilter Group{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null}方块被选中必须满足的条件。
priorityinteger0数字越小越先执行:两个目标冲突时,priority 更小的那个胜出。范围:0 到 …
control_flagsGoal's control flags[]无此目标接管哪些身体部分(移动、看向、跳跃),占用相同部分的目标不能同时运行。

示例

写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):

BP/entities/<name>.json
{
  "minecraft:behavior.move_to_block": {
    "speed_multiplier": 1,
    "search_range": 0,
    "search_height": 1,
    "tick_interval": 20,
    "stay_duration": 0,
    "goal_radius": 0.5,
    "start_chance": 1,
    "target_selection_method": "nearest"
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more