StdLib
Package: com.hypixel.hytale.server.npc.util.expression
public class StdLib extends StdScopeSingleton standard library scope that serves as the root parent for all NPC expression scopes. Registers built-in constants and functions used in NPC role JSON expressions.
Built-in Constants
Section titled “Built-in Constants”| Name | Type | Value |
|---|---|---|
true | BOOLEAN | true |
false | BOOLEAN | false |
PI | NUMBER | 3.1415927 (float-precision Math.PI) |
Built-in Functions
Section titled “Built-in Functions”| Name | Signature | Variant | Description |
|---|---|---|---|
max | max(NUMBER, NUMBER) -> NUMBER | invariant | Returns the larger of two numbers. |
min | min(NUMBER, NUMBER) -> NUMBER | invariant | Returns the smaller of two numbers. |
isEmpty | isEmpty(STRING) -> BOOLEAN | invariant | Returns true if the string is null or empty. |
isEmptyStringArray | isEmptyStringArray(STRING_ARRAY) -> BOOLEAN | invariant | Returns true if the string array has length 0. |
isEmptyNumberArray | isEmptyNumberArray(NUMBER_ARRAY) -> BOOLEAN | invariant | Returns true if the number array has length 0. |
random | random() -> NUMBER | variant | Returns a random double in [0, 1). |
randomInRange | randomInRange(NUMBER, NUMBER) -> NUMBER | variant | Returns a random double in [min, max). |
makeRange | makeRange(NUMBER) -> NUMBER_ARRAY | invariant | Creates a two-element array [v, v] from a single value. |
Methods
Section titled “Methods”| Modifier | Return Type | Signature |
|---|---|---|
public static | StdScope | getInstance() |
Related Types
Section titled “Related Types”- StdScope — parent class providing the symbol table
- Expression — uses this as the root scope for NPC expressions
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.