minecraft:flocking

Allows entities to flock in groups in water or not.

Properties

PropertyTypeDefaultWhat it does
in_waterBooleanfalseTells the Flocking Component if the entity exists in water.
match_variantsBooleanfalseTells the flockers that they can only match similar entities that also match the variant, mark variants, and color data of the other potential flockers.
use_center_of_massBooleanfalseTells the flockers that they will follow flocks based on the center of mass.
low_flock_limitInteger0Determines the low bound amount of entities that can be allowed in the flock.
high_flock_limitInteger0Determines the high bound amount of entities that can be allowed in the flock.
goal_weightDecimal0The weight on which to apply on the goal output.
loner_chanceDecimal0The percentage chance between 0-1 that a fish will spawn and not want to join flocks. Invalid values will be capped at the end points.
influence_radiusDecimal0The area around the entity that allows others to be added to the flock.
breach_influenceDecimal0The amount of push back given to a flocker that breaches out of the water.
separation_weightDecimal1The weight applied to the separation of the flock.
separation_thresholdDecimal2The distance that is determined to be to close to another flocking and to start applying separation.
cohesion_weightDecimal1The weight applied for the cohesion steering of the flock.
cohesion_thresholdDecimal1The threshold in which to start applying cohesion.
innner_cohesion_thresholdDecimal0The distance in which the flocker will stop applying cohesion.
min_heightDecimal0The min height allowable in the air or water.
max_heightDecimal0The max height allowable in the air or water.
block_distanceDecimal0The amount of blocks away the entity will look at to push away from.
block_weightDecimal0The weight of the push back away from blocks.

Example from the game files

This is how vanilla Dolphin uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:flocking": {
    "in_water": false,
    "match_variants": false,
    "use_center_of_mass": false,
    "low_flock_limit": 4,
    "high_flock_limit": 8,
    "goal_weight": 2.0,
    "loner_chance": 0.1,
    "influence_radius": 6.0,
    "breach_influence": 0.0,
    "separation_weight": 1.75,
    "separation_threshold": 3.0,
    "cohesion_weight": 1.85,
    "cohesion_threshold": 6.5,
    "innner_cohesion_threshold": 3.5,
    "min_height": 4.0,
    "max_height": 4.0,
    "block_distance": 1.0,
    "block_weight": 0.0
  }
}

Used by 5

Vanilla entities with minecraft:flocking in their definition:

Related components