Skip to content

ExecutionContext

Package: com.hypixel.hytale.server.npc.util.expression

public class ExecutionContext

Stack-based virtual machine that executes compiled expression instruction sequences. Maintains an operand stack of Operand slots (auto-growing by increments of 8), a current Scope, and optional combat config / interaction variable context. Provides pre-defined static Instruction constants for all arithmetic, logical, bitwise, and comparison operators, plus factory methods for generating PUSH, READ, CALL, and PACK instructions.

NameOperation
UNARY_PLUSNo-op (identity).
UNARY_MINUSNegate top number.
LOGICAL_NOTNegate top boolean.
BITWISE_NOTBitwise complement of top int.
EXPONENTIATIONpow(a, b)
REMAINDERa % b
DIVIDEa / b
MULTIPLYa * b
MINUSa - b
PLUSa + b
GREATER_EQUAL, GREATER, LESS_EQUAL, LESSNumeric comparisons.
NOT_EQUAL, EQUALNumeric equality.
NOT_EQUAL_BOOL, EQUAL_BOOLBoolean equality.
BITWISE_AND, BITWISE_XOR, BITWISE_ORBitwise integer ops.
LOGICAL_AND, LOGICAL_ORShort-circuit boolean ops.
ModifierTypeName
public static finalintSTACK_GROW_INCREMENT
protectedScopescope
protectedOperand[]operandStack
protectedintstackTop
protectedValueTypelastPushedType
protectedStringcombatConfig
protectedMap<String, String>interactionVars
Signature
public ExecutionContext(Scope scope)
public ExecutionContext()
ModifierReturn TypeSignature
publicValueTypeexecute(@Nonnull List<Instruction> instructions, Scope scope)
publicValueTypeexecute(@Nonnull List<Instruction> instructions)
publicValueTypeexecute(@Nonnull Instruction[] instructions, Scope scope)
publicValueTypeexecute(@Nonnull Instruction[] instructions)
ModifierReturn TypeSignature
publicvoidpush(String value)
publicvoidpush(double value)
publicvoidpush(int value)
publicvoidpush(boolean value)
publicvoidpush(String[] value)
publicvoidpush(double[] value)
publicvoidpush(boolean[] value)
publicvoidpushEmptyArray()
publicdoublepopNumber()
publicintpopInt()
publicStringpopString()
publicbooleanpopBoolean()
publicdouble[]popNumberArray()
@Nullable publicString[]popStringArray()
publicboolean[]popBooleanArray()
publicStringpopAsString()
publicvoidpopPush(String value, int popCount)
publicvoidpopPush(double value, int popCount)
publicvoidpopPush(int value, int popCount)
publicvoidpopPush(boolean value, int popCount)
publicvoidpopPush(String[] value, int popCount)
publicvoidpopPush(double[] value, int popCount)
publicvoidpopPush(boolean[] value, int popCount)
publicvoidpopPushEmptyArray(int popCount)
ModifierReturn TypeSignature
@Nonnull public staticInstructiongenPUSH(String value)
@Nonnull public staticInstructiongenPUSH(double value)
@Nonnull public staticInstructiongenPUSH(boolean value)
@Nonnull public staticInstructiongenPUSH(String[] value)
@Nonnull public staticInstructiongenPUSH(double[] value)
@Nonnull public staticInstructiongenPUSH(boolean[] value)
@Nonnull public staticInstructiongenPUSHEmptyArray()
@Nonnull public staticInstructiongenREAD(String ident, @Nonnull ValueType type, @Nullable Scope scope)
@Nonnull public staticInstructiongenCALL(String ident, int numArgs, @Nullable Scope scope)
@Nonnull public staticInstructiongenNumberPACK(int size)
@Nonnull public staticInstructiongenStringPACK(int size)
@Nonnull public staticInstructiongenBooleanPACK(int size)
@Nonnull public staticInstructiongenPACK(@Nonnull ValueType arrayType, int size)
@FunctionalInterface
public interface Instruction {
void execute(ExecutionContext var1);
}

A single executable step in a compiled expression. All operator constants, PUSH/READ/CALL/PACK generators, and user-defined functions implement this interface.

public static class Operand

Mutable value holder on the operand stack. Stores one value of any supported type (string, number, bool, numberArray, stringArray, boolArray) plus a ValueType discriminant. Reused across evaluations to minimize allocation.

  • Expression — high-level compile/execute entry point
  • Scope — variable/function provider
  • ValueType — type discriminant
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.