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

minecraft:behavior.sleep

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

概览

minecraft:behavior.sleep 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 让在村庄里拥有床的生物在夜晚走到床边睡觉。村民会用到它。

字段

字段类型默认值说明
sleep_collider_heightnumber1生物睡觉时碰撞箱的高度。范围:0 到 …
sleep_collider_widthnumber1生物睡觉时碰撞箱的宽度。范围:0 到 …
sleep_y_offsetnumber1睡觉时碰撞箱向上或向下移动的距离。范围:0 到 …
cooldown_timenumber0生物再次使用这个目标前需要等待的秒数。范围:0 到 …
can_sleep_while_ridingbooleanfalse设为 true 时,生物在骑乘时也能睡觉。
timeout_cooldownnumber8目标失败或超时后,再次尝试前等待的秒数。范围:0 到 …
speed_multipliernumber1这个目标运行时让生物加速或减速:1 为正常速度。范围:0 到 …
priorityinteger0多个目标同时想运行时决定谁优先:数字越小越先运行。范围:0 到 …
control_flagsGoal's control flags[]无列出这个目标要控制的身体部分(比如移动、看向或跳跃),这样需要同一部分的目标就不会同时运行。

示例

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

BP/entities/<name>.json
{
  "minecraft:behavior.sleep": {
    "sleep_collider_height": 1,
    "sleep_collider_width": 1,
    "sleep_y_offset": 1,
    "cooldown_time": 0,
    "can_sleep_while_riding": false,
    "timeout_cooldown": 8,
    "speed_multiplier": 1,
    "priority": 0
  }
}

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