Skip to content

NPCMultiSelectCommandBase

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

public abstract class NPCMultiSelectCommandBase extends NPCWorldCommandBase

Abstract base class for NPC commands that can operate on multiple NPCs simultaneously. Extends NPCWorldCommandBase with spatial selection capabilities: cone-based selection from the player’s view direction, sphere-based selection around the player, ray-based selection (single entity in crosshair), and role-based filtering.

If an explicit entity argument is provided, operates on that single NPC. Otherwise, uses the player’s position and view direction to find NPCs within a configurable cone/sphere. Supports preset selection modes and a nearest-only flag.

protected static final float DEFAULT_CONE_ANGLE = 30.0F
protected static final float DEFAULT_RANGE = 8.0F
protected static final float RANGE_MIN = 0.0F
protected static final float RANGE_MAX = 2048.0F
protected static final float CONE_ANGLE_MIN = 0.0F
protected static final float CONE_ANGLE_MAX = 180.0F
@Nonnull
protected final OptionalArg<Float> coneAngleArg

Optional cone half-angle in degrees (0—180). Default: 30.

@Nonnull
protected final OptionalArg<Float> rangeArg

Optional selection range in blocks (0—2048). Default: 8.

FlagCone AngleNearest OnlyDescription
--cone30yesNearest NPC in a 30-degree cone
--coneAll30noAll NPCs in a 30-degree cone
--sphere180noAll NPCs in a sphere
--ray0 (raycast)yesSingle NPC in crosshair

The --roles argument accepts a comma-separated list of role names to filter results. The --nearest flag restricts to the closest matching NPC.

public NPCMultiSelectCommandBase(@Nonnull String name, @Nonnull String description)
public NPCMultiSelectCommandBase(@Nonnull String name, @Nonnull String description, boolean requiresConfirmation)
public NPCMultiSelectCommandBase(@Nonnull String description)
@Override
protected void execute(@Nonnull CommandContext context, @Nonnull World world, @Nonnull Store<EntityStore> store)

Performs spatial NPC selection and delegates to execute for each matched NPC, or to processEntityList for batch processing.

protected void processEntityList(@Nonnull CommandContext context, @Nonnull World world, @Nonnull Store<EntityStore> store, @Nonnull List<Ref<EntityStore>> refs)

Iterates over the selected entity references and calls execute for each NPC. Subclasses may override for custom batch behavior.

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