minecraft:behavior.play_dead for you with a switch.Get GodCraftOverview
minecraft:behavior.play_dead is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes the mob flop over and pretend to be dead after getting hurt, so attackers lose interest. Axolotls use it and heal while doing so.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
duration | number | 1 | How long, in seconds, the mob stays playing dead. |
random_start_chance | number | 1 | Chance that taking damage starts playing dead. |
force_below_health | integer | 0 | If the mob's health drops below this, any damage makes it play dead. |
random_damage_range | IntRange | {"max":0,"min":0} | Damage below the min never starts the goal, damage above the max always does, and in between it is random. |
damage_sources | ActorDamageCause[] | none | Which kinds of damage can make the mob play dead. |
apply_regeneration | boolean | false | If true, the mob gets Regeneration while playing dead. |
filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | Extra conditions that must be true for the mob to play dead. |
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.play_dead": {
"duration": 1,
"random_start_chance": 1,
"force_below_health": 0,
"random_damage_range": {
"max": 0,
"min": 0
},
"damage_sources": [],
"apply_regeneration": false,
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"priority": 0
}
}