Skip to content

InstructionContextHelper

Package: com.hypixel.hytale.server.npc.asset.builder

public class InstructionContextHelper

Validates that components are placed in appropriate instruction and sensor contexts within the NPC behavior tree. Tracks the current InstructionType and ComponentContext, and runs registered evaluators to check context compatibility.

public InstructionContextHelper(InstructionType context)
public boolean isComponent()

Returns true if the instruction context is InstructionType.Component.

public void setComponentContext(ComponentContext context)
public boolean isInCorrectInstruction(@Nonnull EnumSet<InstructionType> validTypes)
public static boolean isInCorrectInstruction(@Nonnull EnumSet<InstructionType> validTypes, InstructionType instructionContext)

Checks if the current instruction type is in the set of valid types.

public boolean extraContextMatches(@Nullable EnumSet<ComponentContext> contexts)
public static boolean extraContextMatches(@Nullable EnumSet<ComponentContext> validContexts, ComponentContext context)

Checks if the component context matches. Returns true if the valid set is null (no constraint).

public void addComponentContextEvaluator(BiConsumer<InstructionType, ComponentContext> evaluator)

Registers a validator to run during validateComponentContext.

public void validateComponentContext(InstructionType instructionContext, ComponentContext componentContext)

Runs all registered evaluators. Only valid when isComponent() is true.

getInstructionContext / getComponentContext

Section titled “getInstructionContext / getComponentContext”
public InstructionType getInstructionContext()
public ComponentContext getComponentContext()
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.