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

minecraft:behavior.nap

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

Overview

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

FieldTypeDefaultDescription
cooldown_minnumber0Shortest wait, in seconds, before the mob can nap again.
cooldown_maxnumber0Longest wait, in seconds, before the mob can nap again.
mob_detect_distnumber6How far sideways the mob checks for nearby mobs that could wake it.
mob_detect_heightnumber6How far up and down the mob checks for nearby mobs that could wake it.
can_nap_filtersFilter 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_exceptionsFilter 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.
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.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": []
  }
}

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