minecraft:behavior.ram_attack for you with a switch.Get GodCraftOverview
minecraft:behavior.ram_attack is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Lets the mob charge at its target with its head and knock it back, like a goat ramming.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
run_speed | number | 1 | Speed while running toward the target before the charge. |
ram_speed | number | 2 | Speed during the charge itself. |
ram_distance | integer | 7 | Distance at which the mob switches to its charging speed. |
min_ram_distance | integer | 4 | The mob only starts a ram if the target is at least this far away. |
baby_knockback_modifier | number | 0.333333 | Changes how strong the knockback is when a baby rams. |
knockback_force | number | 5 | How hard the ram pushes the target away. |
knockback_height | number | 0.1 | How high the ram lifts the target. |
pre_ram_sound | LevelSoundEvent | "undefined" | Sound played just before the charge starts. |
ram_impact_sound | LevelSoundEvent | "undefined" | Sound played when the ram hits. |
on_start | ActorDefinitionTrigger[] | none | Event that runs when the ram attack begins. |
cooldown_range | FloatRange | {"max":20,"min":10} | Random wait, in seconds, between ram attempts. |
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.ram_attack": {
"run_speed": 1,
"ram_speed": 2,
"ram_distance": 7,
"min_ram_distance": 4,
"baby_knockback_modifier": 0.333333,
"knockback_force": 5,
"knockback_height": 0.1,
"pre_ram_sound": "undefined"
}
}