minecraft:behavior.sleep for you with a switch.Get GodCraftOverview
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
| Field | Type | Default | Description |
|---|---|---|---|
sleep_collider_height | number | 1 | Height of the mob's hitbox while sleeping.Range: 0 to … |
sleep_collider_width | number | 1 | Width of the mob's hitbox while sleeping.Range: 0 to … |
sleep_y_offset | number | 1 | How far the hitbox is moved up or down while sleeping.Range: 0 to … |
cooldown_time | number | 0 | Seconds the mob waits before it can use this goal again.Range: 0 to … |
can_sleep_while_riding | boolean | false | If true, the mob can sleep even while riding something. |
timeout_cooldown | number | 8 | Seconds to wait before trying again after the goal fails or times out.Range: 0 to … |
speed_multiplier | number | 1 | Speeds the mob up or slows it down while this goal runs: 1 is normal speed.Range: 0 to … |
priority | integer | 0 | Decides which goal wins when several want to run: lower numbers run first.Range: 0 to … |
control_flags | Goal's control flags[] | none | Lists 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
}
}