Skip to content

com.hypixel.hytale.server.flock

Package: com.hypixel.hytale.server.flock

The flock/group behavior system for NPCs. A flock is a runtime ECS entity in the EntityStore composed of a Flock component, EntityGroup component, and UUIDComponent. Individual NPCs and players join via FlockMembership. Each flock has exactly one leader (elected or interim) and tracks group damage data via double-buffered DamageData.

Flocks are configured via FlockAsset (JSON) which specifies size ranges, grow limits, and blocked roles. The plugin provides 10 NPC core component types for AI integration including steering behavior, inter-NPC messaging, combat damage sensing, and group state management.

Key behaviors:

  • Leader election — players always become leader; NPCs with canLeadFlock are eligible; if no leader can be found, the flock dissolves
  • Friendly-fire prevention — damage between flock members is cancelled
  • Group damage tracking — double-buffered per-tick tracking of incoming/outgoing damage for both the group and leader
  • Flock dissolution — flock is dissolved when size drops below 2 or no eligible leader exists
TypeKindDescription
FlockPluginclassCentral plugin registering all ECS infrastructure and NPC component types.
TypeKindDescription
FlockclassCore flock entity component with damage tracking and removal status.
FlockMembershipclassPer-member component linking entity to its flock (serialized).
PersistentFlockDataclassSerialized flock metadata — max size, allowed roles, current size.
TypeKindDescription
FlockSystemsclassFlock entity lifecycle: removal, ticking, debug visualization, game mode events.
FlockMembershipSystemsclassMembership processing: join/leave, leader election, damage tracking, friendly fire.
FlockDeathSystemsclassRemoves membership on NPC/player death; notifies attacker flock of kills.
TypeKindDescription
StoredFlockclassSerializable container for persisting flock NPCs during spawn marker deactivation.
TypeKindDescription
FlockAssetabstract classBase class for flock JSON definitions (path: NPC/Flocks).
RangeSizeFlockAssetclassDefault flock asset — size from a [min, max] range.
WeightedSizeFlockAssetclassWeighted flock asset — size from weighted probability distribution.
TypeKindDescription
NPCFlockCommandclass/flock command collection: grab, join, leave, playerleave.

Decision Maker (sub-package: decisionmaker.conditions)

Section titled “Decision Maker (sub-package: decisionmaker.conditions)”
TypeKindDescription
FlockSizeConditionclassDecision-maker condition returning current flock size for AI behavior.

The flock system interacts with:

  • Spawning systemFlockPlugin.trySpawnFlock() is called by spawn controllers to create flock groups; StoredFlock persists NPCs during deactivation
  • NPC system — 10 NPC core component types provide AI integration (steering, messaging, sensing, filtering)
  • Damage systemDamageEventSystem implementations track flock damage and prevent friendly fire
  • Entity systemEntityGroup manages member references; UUIDComponent provides flock identity
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.