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

minecraft:behavior.random_swim

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

Overview

minecraft:behavior.random_swim is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes a water mob swim to random spots in the water. Use it for fish and other swimmers.

Fields

FieldTypeDefaultDescription
avoid_surfacebooleantrueIf true, the mob stays under the top layer of water.
speed_multipliernumber1Speeds the mob up or slows it down while this goal runs: 1 is normal speed.
xz_distinteger10How far sideways the mob looks for a new spot. Must be at least 1.
y_distinteger7How far up and down the mob looks for a new spot. Must be at least 1.
intervalinteger120Sets how often the goal is picked: there is a 1 in interval chance each time. Bigger values mean the mob moves less often.
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.random_swim": {
    "avoid_surface": true,
    "speed_multiplier": 1,
    "xz_dist": 10,
    "y_dist": 7,
    "interval": 120,
    "priority": 0,
    "control_flags": []
  }
}

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