minecraft:behavior.nap for you with a switch.Get GodCraftOverview
minecraft:behavior.nap is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Lets a mob lie down for a nap now and then, like a fox sleeping in the day. It wakes up when certain mobs come close.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
cooldown_min | number | 0 | Shortest wait, in seconds, before the mob can nap again. |
cooldown_max | number | 0 | Longest wait, in seconds, before the mob can nap again. |
mob_detect_dist | number | 6 | How far sideways the mob checks for nearby mobs that could wake it. |
mob_detect_height | number | 6 | How far up and down the mob checks for nearby mobs that could wake it. |
can_nap_filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | Conditions that must be true for the mob to fall asleep. |
wake_mob_exceptions | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | Mobs that match these filters will not wake it up. |
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.nap": {
"cooldown_min": 0,
"cooldown_max": 0,
"mob_detect_dist": 6,
"mob_detect_height": 6,
"can_nap_filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"wake_mob_exceptions": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"priority": 0,
"control_flags": []
}
}