1. Wiki
  2. /Entities
  3. /minecraft:behavior.swim_with_entity

minecraft:behavior.swim_with_entity

Don't want to write this by hand? GodCraft sets minecraft:behavior.swim_with_entity for you with a switch.Get GodCraft

Overview

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

FieldTypeDefaultDescription
success_ratenumber0.1Chance from 0 to 1 that the mob starts following someone.
chance_to_stopnumber0.0333Chance from 0 to 1 to stop following when the other entity is riding something or not swimming.
state_check_intervalnumber0.5Seconds between checks on whether to catch up or match direction.Range: 0 to …
catch_up_thresholdnumber12If the followed entity is farther than this, the mob speeds up to catch it.
match_direction_thresholdnumber2Within this distance the mob tries to swim the same way as the followed entity.
catch_up_multipliernumber2.5Speed multiplier used while catching up.
speed_multipliernumber1.5Speed multiplier used while matching direction.
search_rangenumber20How far around the mob it looks for someone to swim with.
stop_distancenumber5If the followed entity gets this far away, the mob stops following.
entity_typesMobDescriptor[]noneWhich entities the mob is allowed to swim with.
priorityinteger0Decides which goal wins when several want to run: lower numbers run first.Range: 0 to …
control_flagsGoal's control flags[]noneLists 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
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more