9.2. Built-in Namespaces
Quick reference for built-in namespace functions and types. For creating and using namespaces, see Namespaces.
9.2.1. entity
Entity type utilities.
Type |
Description |
|---|---|
|
Represents a Minecraft entity type (e.g., ZOMBIE, CREEPER). |
Variable |
Type |
Value |
|---|---|---|
|
EntityType |
Represents an acacia boat entity. |
|
EntityType |
Represents an acacia chest boat entity. |
… |
EntityType |
[all other Minecraft entity types] |
|
EntityType |
Represents a zombie villager entity. |
|
EntityType |
Represents a zombified piglin entity. |
The entity namespace has no functions.
9.2.2. format
Text formatting utilities.
Type |
Description |
|---|---|
|
Represents a text color or formatting code. |
Function |
Return Type |
Description |
|---|---|---|
|
String |
Format a Unix timestamp (milliseconds) using the given format string. |
|
TextFormat |
Get a TextFormat from a color code character (e.g., |
|
String |
Remove all color codes from a string. |
Variable |
Type |
Value |
|---|---|---|
|
TextFormat |
“§0” (black color code) |
|
TextFormat |
“§1” (dark blue color code) |
… |
TextFormat |
[all other formatting codes] |
|
TextFormat |
“§n” (underline format code) |
|
TextFormat |
“§r” (reset format code) |
9.2.3. list
List utility functions.
Function |
Return Type |
Description |
|---|---|---|
|
Int[] |
Generate a list of consecutive integers from start (inclusive) to end (exclusive). |
The list namespace has no types or variables.
9.2.4. material
Material/block type utilities.
Type |
Description |
|---|---|
|
Represents a Minecraft material (item). |
Variable |
Type |
Value |
|---|---|---|
|
Material |
Represents an acacia boat item. |
|
Material |
Represents an acacia button item. |
… |
Material |
[all other Minecraft items and blocks] |
|
Material |
Represents a zombie wall head item. |
|
Material |
Represents a zombified piglin spawn egg item. |
The material namespace has no functions.
9.2.5. math
Common mathematical operations.
Function |
Return Type |
Description |
|---|---|---|
|
Double |
Absolute value (value if positive, -value if negative). |
|
Double |
Positive square root. |
|
Double |
Base raised to the power of exponent. |
|
Int |
Round down to nearest integer (towards negative infinity). |
|
Int |
Round up to nearest integer (towards positive infinity). |
|
Double |
Sine of x (degrees). |
|
Double |
Cosine of x (degrees). |
|
Double |
Tangent of x (degrees). |
|
Double |
Arcsine of x (returns degrees). |
|
Double |
Arccosine of x (returns degrees). |
|
Double |
Arctangent of x (returns degrees). |
|
Double |
Sine of x (radians). |
|
Double |
Cosine of x (radians). |
|
Double |
Tangent of x (radians). |
|
Double |
Arcsine of x (returns radians). |
|
Double |
Arccosine of x (returns radians). |
|
Double |
Arctangent of x (returns radians). |
|
Double |
Convert degrees to radians. |
|
Double |
Convert radians to degrees. |
|
Double |
Random double between min and max. |
|
Double |
Random double between 0.0 and 1.0. |
|
Float |
Random float between 0.0 and 1.0. |
|
Int |
Random integer (full Int range). |
|
Long |
Random long (full Long range). |
The math namespace has no types or variables. For special cases (NaN, infinity, etc.), see Java Math documentation.
9.2.6. minr
Minr-specific map and challenge utilities.
Type |
Description |
|---|---|
|
Represents a Minr challenge. |
|
Represents a Minr map. |
The minr namespace has no functions or variables.
9.2.7. scoreboard
Minecraft scoreboard manipulation.
Function |
Return Type |
Description |
|---|---|---|
|
Void |
Create a new scoreboard objective. |
|
Void |
Remove a scoreboard objective. |
|
Boolean |
Check whether an objective exists. |
|
Int |
Get a player’s score for a given objective. |
|
Void |
Set a player’s score for a given objective. |
|
Void |
Set which slot displays the objective. |
|
String |
Get the display slot for an objective. |
|
String |
Get which objective is in a display slot. |
|
Void |
Clear a display slot. |
|
Void |
Reset an objective’s display slot. |
The scoreboard namespace has no types or variables.
9.2.8. statistic
Minecraft statistic utilities.
Type |
Description |
|---|---|
|
Represents a Minecraft statistic (e.g., JUMP, WALK_ONE_CM). No constructors. |
Variable |
Type |
Value |
|---|---|---|
|
Statistic |
Represents the ANIMALS_BRED statistic. |
|
Statistic |
Represents the ARMOR_CLEANED statistic. |
… |
Statistic |
[all other Minecraft statistics] |
|
Statistic |
Represents the WALK_ONE_CM statistic. |
|
Statistic |
Represents the WALK_UNDER_WATER_ONE_CM statistic. |
The statistic namespace has no functions.
9.2.9. system
Miscellaneous system functions.
Function |
Return Type |
Description |
|---|---|---|
|
Long |
Returns the current time in milliseconds since Unix epoch (January 1, 1970). |
|
Double[] |
Returns a list of 3 values: average server TPS over the last 1, 5, and 15 minutes. |
The system namespace has no types or variables.
9.2.10. text
Rich text (JSON chat component) utilities.
Type |
Description |
|---|---|
|
A single rich text component with formatting, click events, etc. |
|
Builder pattern for constructing TextComponent arrays. |
Function |
Return Type |
Description |
|---|---|---|
|
TextComponent[] |
Parse JSON text into components. |
|
String |
Convert components to JSON. |
|
TextComponent[] |
Convert legacy color-coded text to components. |
|
String |
Convert components to legacy color-coded text. |
|
String |
Strip formatting, return plain text. |
|
String |
Escape special characters in JSON. |
The text namespace has no variables.
9.2.11. timer
Timer management functions for maps and challenges.
Type |
Description |
|---|---|
|
Represents a timer instance for tracking player progress. |
Function |
Return Type |
Description |
|---|---|---|
|
Timer |
Get a player’s timer for a map. |
|
Timer |
Get a player’s timer for a challenge. |
|
Timer |
Get a player’s custom timer by tag. |
|
Timer |
Get a player’s special timer. |
|
Void |
Remove a custom timer. |
|
String |
Format a time value as a human-readable string. |
The timer namespace has no variables.
Warning
Never store Timer instances in namespace variables, as they will break silently. Always use timer::getCustomTimer(...) to retrieve a fresh reference each time.
9.2.12. util
Utility functions.
Function |
Return Type |
Description |
|---|---|---|
|
Boolean |
Run an |
|
Int |
Run an |
|
String |
Generate a random UUID string. |
The util namespace has no types or variables.