Skip to content

NPCFlockCommand

Package: com.hypixel.hytale.server.flock.commands

public class NPCFlockCommand extends AbstractCommandCollection

The /flock command collection for managing flocks from in-game. Provides four subcommands for players to interact with the flock system.

ConstantValueDescription
ENTITY_IN_VIEW_DISTANCE8.0Maximum distance for view cone entity detection.
ENTITY_IN_VIEW_ANGLE30.0FHalf-angle of the view cone in degrees.
ENTITY_IN_VIEW_HEIGHT2Maximum Y difference for view cone matching.
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.

Adds nearby NPCs (in view cone) to the player’s flock. If the player is not in a flock, creates one first.

Player joins the flock of the nearest NPC in their view cone that is already in a flock.

Removes all nearby NPCs (in view cone) from their flocks.

The player leaves their current flock.

Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.