NPCFlockCommand
Package: com.hypixel.hytale.server.flock.commands
public class NPCFlockCommand extends AbstractCommandCollectionThe /flock command collection for managing flocks from in-game. Provides four subcommands for players to interact with the flock system.
Constants
Section titled “Constants”| Constant | Value | Description |
|---|---|---|
ENTITY_IN_VIEW_DISTANCE | 8.0 | Maximum distance for view cone entity detection. |
ENTITY_IN_VIEW_ANGLE | 30.0F | Half-angle of the view cone in degrees. |
ENTITY_IN_VIEW_HEIGHT | 2 | Maximum Y difference for view cone matching. |
Static Utility Methods
Section titled “Static Utility Methods”public static int forNpcEntitiesInViewCone(@Nonnull Ref<EntityStore> playerReference, @Nonnull Store<EntityStore> store, @Nonnull BiPredicate<Ref<EntityStore>, NPCEntity> predicate)Iterates NPCs within the player’s view cone (8 block distance, 30-degree half-angle, 2-block height tolerance) using the NPC spatial index. Returns the count of entities for which the predicate returned true.
public static boolean anyEntityInViewCone(@Nonnull Ref<EntityStore> playerReference, @Nonnull Store<EntityStore> store, @Nonnull Predicate<Ref<EntityStore>> predicate)Returns true if any entity in the view cone matches the predicate. Uses distance-ordered results for nearest-first matching.
Subcommands
Section titled “Subcommands”GrabCommand
Section titled “GrabCommand”Adds nearby NPCs (in view cone) to the player’s flock. If the player is not in a flock, creates one first.
JoinCommand
Section titled “JoinCommand”Player joins the flock of the nearest NPC in their view cone that is already in a flock.
LeaveCommand
Section titled “LeaveCommand”Removes all nearby NPCs (in view cone) from their flocks.
PlayerLeaveCommand
Section titled “PlayerLeaveCommand”The player leaves their current flock.
Related Types
Section titled “Related Types”- FlockMembershipSystems —
join()used by grab and join commands - FlockPlugin —
createFlock()andgetFlockReference()used by commands