minecraft:behavior.swim_with_entity for you with a switch.Get GodCraftOverview
minecraft:behavior.swim_with_entity is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes the mob swim along with another entity, catching up when it falls behind and matching its direction. Dolphins use it to swim with players.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
success_rate | number | 0.1 | Chance from 0 to 1 that the mob starts following someone. |
chance_to_stop | number | 0.0333 | Chance from 0 to 1 to stop following when the other entity is riding something or not swimming. |
state_check_interval | number | 0.5 | Seconds between checks on whether to catch up or match direction.Range: 0 to … |
catch_up_threshold | number | 12 | If the followed entity is farther than this, the mob speeds up to catch it. |
match_direction_threshold | number | 2 | Within this distance the mob tries to swim the same way as the followed entity. |
catch_up_multiplier | number | 2.5 | Speed multiplier used while catching up. |
speed_multiplier | number | 1.5 | Speed multiplier used while matching direction. |
search_range | number | 20 | How far around the mob it looks for someone to swim with. |
stop_distance | number | 5 | If the followed entity gets this far away, the mob stops following. |
entity_types | MobDescriptor[] | none | Which entities the mob is allowed to swim with. |
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.swim_with_entity": {
"success_rate": 0.1,
"chance_to_stop": 0.0333,
"state_check_interval": 0.5,
"catch_up_threshold": 12,
"match_direction_threshold": 2,
"catch_up_multiplier": 2.5,
"speed_multiplier": 1.5,
"search_range": 20
}
}