minecraft:behavior.use_kinetic_weapon for you with a switch.Get GodCraftOverview
minecraft:behavior.use_kinetic_weapon is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Lets a mob fight with a charging weapon like a spear: it rushes at its target, then backs off and charges again. The weapon item needs minecraft:kinetic_weapon.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
approach_distance | number | 8 | The mob starts using its weapon once the target is this close.Range: 0 to … |
reposition_distance | FloatRange | {"max":2,"min":2} | How far the mob backs away after the target gets too close, before charging again. Added to the middle of the weapon's reach. |
reposition_speed_multiplier | number | 1 | Speed multiplier while backing away to charge again.Range: 0 to … |
cooldown_distance | FloatRange | {"max":8,"min":8} | How far the mob backs away once the weapon's charge time is used up. Added to the middle of the weapon's reach. |
cooldown_speed_multiplier | number | 1 | Speed multiplier while backing away on cooldown.Range: 0 to … |
weapon_reach_multiplier | number | 1 | Scales the weapon's reach for this mob.Range: 0 to … |
weapon_min_speed_multiplier | number | 1 | Scales the minimum speeds the weapon needs to deal damage.Range: 0 to … |
hijack_mount_navigation | boolean | false | If true, the mob steers its mount with this goal. The mount must have the mount_pathing goal. |
on_kill | ActorDefinitionTrigger | {"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"} | Event that runs when this mob kills its target. |
cooldown_time | number | 1 | Seconds between attacks.Range: 0 to … |
melee_fov | number | 90 | Field of view, in degrees, used to spot a target to attack.Range: 0 to … |
x_max_rotation | number | 30 | How far, in degrees, the mob can tilt up or down while looking at the target.Range: 0 to … |
y_max_head_rotation | number | 30 | How far, in degrees, the mob can turn its head sideways while looking at the target.Range: 0 to … |
random_stop_interval | integer | 0 | Gives a 1 in N chance to stop the current attack, where N is this value. Use 0 to never stop at random.Range: 0 to … |
attack_once | boolean | false | If true, the mob only ever does this attack once in its life. |
can_spread_on_fire | boolean | false | If true, a burning mob with an empty hand sets its target on fire when it hits. |
min_path_time | number | 0.2 | Shortest base time, in seconds, before the mob plans a new path to the target.Range: 0 to … |
max_path_time | number | 0.55 | Longest base time, in seconds, before the mob plans a new path to the target.Range: 0 to … |
path_fail_time_increase | number | 0.75 | Extra seconds added before planning a new path when the mob can't follow its current one.Range: 0 to … |
inner_boundary_time_increase | number | 0.25 | Extra seconds added before planning a new path when the target is farther than path_inner_boundary.Range: 0 to … |
outer_boundary_time_increase | number | 0.5 | Extra seconds added before planning a new path when the target is farther than path_outer_boundary.Range: 0 to … |
path_inner_boundary | number | 16 | Distance past which inner_boundary_time_increase is added.Range: 0 to … |
path_outer_boundary | number | 32 | Distance past which outer_boundary_time_increase is added.Range: 0 to … |
speed_multiplier | number | 1 | Speed multiplier while moving toward the target.Range: 0 to … |
require_complete_path | boolean | false | If true, the mob only chases a target it has a full path to. |
track_target | boolean | false | If true, the mob keeps tracking the target even without a built-in way to sense it. |
attack_types | string | "" | Which entity types this mob will attack. |
on_attack | ActorDefinitionTrigger | {"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"} | Event that runs each time the mob lands a hit. |
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.use_kinetic_weapon": {
"approach_distance": 8,
"reposition_distance": {
"max": 2,
"min": 2
},
"reposition_speed_multiplier": 1,
"cooldown_distance": {
"max": 8,
"min": 8
},
"cooldown_speed_multiplier": 1,
"weapon_reach_multiplier": 1,
"weapon_min_speed_multiplier": 1,
"hijack_mount_navigation": false
}
}