Skip to content

FlockPlugin

Package: com.hypixel.hytale.server.flock

public class FlockPlugin extends JavaPlugin

Central plugin for the flock/group behavior system. Registers all ECS components (Flock, FlockMembership, PersistentFlockData), systems (FlockSystems, FlockMembershipSystems, FlockDeathSystems), the FlockAsset store, 10 NPC core component types for AI integration, and the FlockSize decision-maker condition.

public static FlockPlugin get()

Returns the singleton instance.

@Nullable
public static Ref<EntityStore> trySpawnFlock(@Nonnull Ref<EntityStore> npcRef, @Nonnull NPCEntity npc, @Nonnull Store<EntityStore> store, int roleIndex, @Nonnull Vector3d position, Vector3f rotation, @Nullable FlockAsset flockDefinition, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn)

Attempts to spawn a flock of NPCs around a leader. Picks the flock size from the FlockAsset, creates a flock entity, joins the leader, then spawns additional members at randomized positions around the leader. Each member is spawned via NPCPlugin.spawnEntity() and joined to the flock.

@Nonnull
public static Ref<EntityStore> createFlock(@Nonnull Store<EntityStore> store, @Nullable FlockAsset flockDefinition, @Nonnull String[] allowedRoles)

Creates a new flock entity with UUIDComponent, EntityGroup, and Flock components.

@Nullable
public static Ref<EntityStore> getFlockReference(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)

Returns the flock entity reference for a member, or null if not in a flock.

public static boolean isFlockMember(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store)

Returns true if the entity has a FlockMembership component.

@Nullable
@Deprecated
public static Flock getFlock(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> reference)

Deprecated — returns the Flock component for a member’s flock entity.

public ComponentType<EntityStore, Flock> getFlockComponentType()
public ComponentType<EntityStore, FlockMembership> getFlockMembershipComponentType()
public ComponentType<EntityStore, PersistentFlockData> getPersistentFlockDataComponentType()
@Nonnull
public UUID getPrefabRemappedFlockReference(int prefabId, UUID oldId)

Returns a remapped UUID for flock references during prefab paste operations.

NPC TypeBuilderRuntimeCategory
FlockBuilderBodyMotionFlockBodyMotionFlockBodyMotion
JoinFlockBuilderActionFlockJoinActionFlockJoinAction
LeaveFlockBuilderActionFlockLeaveActionFlockLeaveAction
FlockStateBuilderActionFlockStateActionFlockStateAction
FlockTargetBuilderActionFlockSetTargetActionFlockSetTargetAction
FlockBeaconBuilderActionFlockBeaconActionFlockBeaconAction
FlockBuilderEntityFilterFlockEntityFilterFlockEntityFilter
FlockCombatDamageBuilderSensorFlockCombatDamageSensorFlockCombatDamageSensor
InflictedDamageBuilderSensorInflictedDamageSensorInflictedDamageSensor
FlockLeaderBuilderSensorFlockLeaderSensorFlockLeaderSensor
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.