minecraft:behavior.panic for you with a switch.Get GodCraftOverview
minecraft:behavior.panic is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes the mob run around in a hurry, away from whatever hurt it. Animals like cows and chickens use it when hit.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
damage_sources | List | "[campfire, fire, fire_tick, freezing, lava, lightning, magma, soul_campfire, temperature, entity_attack, entity_explosion, fireworks, magic, projectile, ram_attack, sonic_boom, wither, mace_smash]" | Which kinds of damage make the mob panic, such as "fire" or "entity_attack". |
force | Boolean | "false" | If true, the mob keeps panicking until it can't move or the goal is removed. |
ignore_mob_damage | Boolean | "false" | If true, damage from other mobs never causes panic, even if listed in damage_sources. |
prefer_water | Boolean | "false" | If true, the panicking mob tries to run toward water. |
speed_multiplier | Decimal | "1.0" | Speeds the mob up or slows it down while this goal runs: 1 is normal speed. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.panic": {
"damage_sources": "[campfire, fire, fire_tick, freezing, lava, lightning, magma, soul_campfire, temperature, entity_attack, entity_explosion, fireworks, magic, projectile, ram_attack, sonic_boom, wither, mace_smash]",
"force": "false",
"ignore_mob_damage": "false",
"prefer_water": "false",
"speed_multiplier": "1.0"
}
}