minecraft:flocking for you with a switch.Get GodCraftOverview
minecraft:flocking is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes the entity move in a group with others of its kind, like a school of fish. Lots of weights let you tune how tightly the group sticks together.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
in_water | boolean | false | Set to true if the flock lives in water. |
match_variants | boolean | false | Only flock with entities that have the same variant, mark variant and color. |
use_center_of_mass | boolean | false | Steer toward the middle of the flock. |
low_flock_limit | integer | 0 | Smallest number of entities a flock should have. |
high_flock_limit | integer | 0 | Largest number of entities allowed in a flock. |
goal_weight | number | 0 | How strongly the flocking result affects movement. |
loner_chance | number | 0 | Chance from 0 to 1 that the entity spawns as a loner that never joins a flock. |
influence_radius | number | 0 | Distance within which other entities can join this one's flock. |
breach_influence | number | 0 | How hard a flock member is pushed back when it jumps out of the water. |
separation_weight | number | 1 | How strongly members keep space between each other. |
separation_threshold | number | 2 | Distance at which members start moving apart because they are too close. |
cohesion_weight | number | 1 | How strongly members steer toward each other. |
cohesion_threshold | number | 1 | Distance at which members start pulling together. |
innner_cohesion_threshold | number | 0 | Distance at which members stop pulling closer. |
min_height | number | 0 | Lowest height the flock may move at. |
max_height | number | 0 | Highest height the flock may move at. |
block_distance | number | 0 | How many blocks ahead the entity checks for blocks to steer away from. |
block_weight | number | 0 | How strongly the entity steers away from blocks. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:flocking": {
"in_water": false,
"match_variants": false,
"use_center_of_mass": false,
"low_flock_limit": 0,
"high_flock_limit": 0,
"goal_weight": 0,
"loner_chance": 0,
"influence_radius": 0
}
}