1. Wiki
  2. /Entities
  3. /minecraft:behavior.sleep

minecraft:behavior.sleep

Don't want to write this by hand? GodCraft sets minecraft:behavior.sleep for you with a switch.Get GodCraft

Overview

minecraft:behavior.sleep is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Lets a mob that owns a bed in a village walk to it and sleep there at night. Villagers use it.

Fields

FieldTypeDefaultDescription
sleep_collider_heightnumber1Height of the mob's hitbox while sleeping.Range: 0 to …
sleep_collider_widthnumber1Width of the mob's hitbox while sleeping.Range: 0 to …
sleep_y_offsetnumber1How far the hitbox is moved up or down while sleeping.Range: 0 to …
cooldown_timenumber0Seconds the mob waits before it can use this goal again.Range: 0 to …
can_sleep_while_ridingbooleanfalseIf true, the mob can sleep even while riding something.
timeout_cooldownnumber8Seconds to wait before trying again after the goal fails or times out.Range: 0 to …
speed_multipliernumber1Speeds the mob up or slows it down while this goal runs: 1 is normal speed.Range: 0 to …
priorityinteger0Decides which goal wins when several want to run: lower numbers run first.Range: 0 to …
control_flagsGoal's control flags[]noneLists the body parts this goal takes control of (such as move, look or jump), so goals that need the same part don't run together.

Example

Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):

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