minecraft:behavior.move_around_target for you with a switch.Get GodCraftOverview
minecraft:behavior.move_around_target is an entity component: it goes in the components object of a custom mob, or in one of its component groups. AI goal that keeps the mob at a good distance from its target: it backs off when too close and moves to a random spot nearer when too far.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
destination_position_range | FloatRange | {"max":8,"min":4} | Closest and farthest from the target that the mob looks for a spot to move to. |
movement_speed | number | 0.6 | How fast the mob moves to the chosen spot. |
destination_pos_spread_degrees | number | 90 | How wide, in degrees, the chosen spot behind the target can vary. 0 picks straight behind it. |
filters | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | Conditions that must pass before the goal starts. |
height_difference_limit | number | 10 | The mob only counts as too close if the height gap to the target is below this.Range: 0 to … |
horizontal_search_distance | integer | 5 | How far sideways, in blocks, the mob searches for a spot away from the target.Range: 0 to … |
vertical_search_distance | integer | 5 | How far up and down, in blocks, the mob searches for a spot away from the target.Range: 0 to … |
priority | integer | 0 | Lower numbers run first: when two goals compete, the one with the smaller priority wins.Range: 0 to … |
control_flags | Goal's control flags[] | none | Which body parts this goal takes over (move, look, jump), so goals using the same parts cannot run together. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.move_around_target": {
"destination_position_range": {
"max": 8,
"min": 4
},
"movement_speed": 0.6,
"destination_pos_spread_degrees": 90,
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"height_difference_limit": 10,
"horizontal_search_distance": 5,
"vertical_search_distance": 5,
"priority": 0
}
}