InstructionContextHelper
Package: com.hypixel.hytale.server.npc.asset.builder
public class InstructionContextHelperValidates 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.
Constructor
Section titled “Constructor”public InstructionContextHelper(InstructionType context)Methods
Section titled “Methods”isComponent
Section titled “isComponent”public boolean isComponent()Returns true if the instruction context is InstructionType.Component.
setComponentContext
Section titled “setComponentContext”public void setComponentContext(ComponentContext context)isInCorrectInstruction
Section titled “isInCorrectInstruction”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.
extraContextMatches
Section titled “extraContextMatches”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).
addComponentContextEvaluator
Section titled “addComponentContextEvaluator”public void addComponentContextEvaluator(BiConsumer<InstructionType, ComponentContext> evaluator)Registers a validator to run during validateComponentContext.
validateComponentContext
Section titled “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()Related Types
Section titled “Related Types”- InstructionType — instruction context enum
- ComponentContext — sensor context enum
- Builder —
getInstructionContextHelper()returns this
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.