-
Notifications
You must be signed in to change notification settings - Fork 14
09. Built‐in Block State Format
MiEx has its own custom format for block states and entities, which provides a powerful system to define these. This format was originally created because Minecraft has a couple of blocks whose block states and block models were hardcoded in the game, and so MiEx also had them hardcoded. But, that makes those blocks difficult to customise and when more of those blocks get added to the game, it would require a new update of the MiEx.jar file which users would need to wait on. By having this new format that is able to define these blocks, it makes it a lot easier to add support when those kinds of blocks get added to the game or when users want to export out modded blocks that are too complex to be defined using Minecraft's own block state and block model format.
This system has also been extended for entities, initially to be able to export out item frames, paintings, and display entities, but this can also be used to export out any other entity as well.
Examples of the blockstate and entity files can be found in the existing implementions of some Minecraft blocks and entities and the mod compatibility example resource pack.
Blockstate files define blocks and how MiEx should export those blocks out. They are located in builtins/<namespace>/blockstates. They can be any name (must end with .json) and can be organised into folders. A blockstate file is a JSON object. It extends the built-in model format defined later on this page.
The blockstate file can define the following keys:
| key | description |
|---|---|
blocks |
A list of block names that this blockstate file defines the blockstate for. This means that a single file can be used for multiple blocks. |
tint |
A tint object to apply to this block. This is the same as what would be specified in miex_block_tints.json, but then provided here for convenience. |
isLocationDependent |
A boolean. If true, the evaluation of the model depends on the location of the block (including neighbouring blocks) rather than just the properties of the block. |
isAnimated |
A boolean. If true, this blockstate file defines a block animation as well. thisBlock.time can be used to query the animation time in seconds. |
animationDuration |
The duration in seconds of the animation, after which it'll loop. |
animationRandomOffsetXZ |
Should the animation be randomly offset per block based on the block's X and Z position. The same as adding the block to randomAnimationXZOffset in miex_config.json
|
animationRandomOffsetY |
Should the animation be randomly offset per block based on the block's Y position. The same as adding the block to randomAnimationYOffset in miex_config.json
|
animatedTopology |
Required. A boolean. If true, indicates that the topology is animated in this block state. |
animatedPoints |
Required. A boolean. If true, indicates that the vertex positions are animated in this block state. |
animatedUVs |
Required. A boolean. If true, indicates that the UVs are animated in this block state. |
animatedVertexColors |
Required. A boolean. If true, indicates that the vertex colours are animated in this block state. |
include |
A list of resource identifiers for other blockstate files that this blockstate file includes and thus builds on top of. If a resource identifier of the same name as the current file is used, then it'll include the blockstate file defined in the resource packs below the current resource pack. In other words, it allows you to only override certain keys in the blockstate file rather than the entire blockstate file. |
The other keys that a blockstate file can define, is defined in the built-in model format.
Entity files define entities and how MiEx should export those entities out. They are located in builtins/<namespace>/entities. They can be any name (must end with .json) and can be organised into folders. An entity file is a JSON object. It extends the built-in model format defined later on this page.
The entity file can define the following keys:
| key | description |
|---|---|
entities |
A list of entity names that this entity file defines the entity handler for. This means that a single file can be used for multiple entities. |
isLocationDependent |
A boolean. If true, the evaluation of the model depends on the location of the entity rather than just the properties of the entity. |
posX |
An optional expression that sets the X position of the entity. By default it sets it to the position defined in the entity data. |
posY |
An optional expression that sets the Y position of the entity. By default it sets it to the position defined in the entity data. |
posZ |
An optional expression that sets the Z position of the entity. By default it sets it to the position defined in the entity data. |
rotX |
An optional expression that sets the pitch of the entity. By default it sets it to the rotation defined in the entity data. |
rotY |
An optional expression that sets the yaw of the entity. By default it sets it to the rotation defined in the entity data. |
include |
A list of resource identifiers for other entity files that this entity file includes and thus builds on top of. If a resource identifier of the same name as the current file is used, then it'll include the entity file defined in the resource packs below the current resource pack. In other words, it allows you to only override certain keys in the entity file rather than the entire entity file. |
The other keys that a entity file can define, is defined in the built-in model format.
Attachment files define attachments and how MiEx should export those attachments out. They are located in builtins/<namespace>/attachments. They can be any name (must end with .json) and can be organised into folders. An attachment file is a JSON object. The JSON object contains a property called attachments which is a JSON list of item ids for which this provides attachment models for. The JSON object also contains key/value pairs where the keys are attachment locations and the values are JSON objects following the Built-in Model format to specify the model for that attachment location. Attachment locations may be none, head, body, leftShoulder, rightShoulder, leftLeg, rightLeg, leftHand, and rightHand.
The built in model format defines the following keys:
| key | description |
|---|---|
defaultTexture |
The resource identifier of the default texture for the model. This is used to generate a block colour shown in the top-down viewport. |
doubleSided |
A boolean of whether or not the model should be double sided. Defaults to false. |
generators |
A json object where each key is the name of a local generator and the value is the generator definition. Generators are defined later on. |
functions |
A json object where each key is the name of a local function and the value is the function definition. Functions are defined later on. |
handler |
A model part. This defines the actual model. |
There are two kinds of model parts, array parts and object parts. These define the actual model data.
An array model part is a json array where each item is a model part.
An object model part is a json object with the following keys:
| key | description |
|---|---|
condition |
An optional expression that evaluates to either true or false. If it evaluates to false, it skips this model part (including its children). |
loopCondition |
An optional expression that evaluates to either true or false. If defined, it turns this object model part into a loop. variables, textures, generators, elements, and children are evaluated however many times until loopCondition evaluates to false. There currently is a hardcoded limit of 10,000 iterations. |
loopInit |
An optional expression that is evaluated before looping starts, which can be used to initialise some variables for the looping. |
loopIncrement |
An optional expression that is evaluated at the end of each iteration of the loop. |
variables |
An optional expression or json array of expressions to evaluate. This can be used to set up variables for later use. |
textures |
An optional json object defining textures to be used. The keys are texture variable names and the values are expressions that should evaluate to a string containing the texture resource identifiers for the texture variables. |
generators |
An optional json object that is a generator call or json array of json objects that are generator calls. Generator calls are defined later on. |
elements |
An optional json array of model elements. Model elements are defined later on. |
children |
An optional model part that is a child of this model part. |
transform |
An optional json array of transformations to be applied to this model part, including its children. Transforms are defined later on. |
A transform is a json object that can translate, rotate, and scale a model part. It defines the following keys:
| key | description |
|---|---|
translate |
An optional json array containing one to three expressions, corresponding to X, Y, and Z translation. If only one expression is provided, that value is set on all three components. If only two expressions are provided, Z equals Y. |
rotate |
An optional json array containing one to three expressions, corresponding to X, Y, and Z Euler rotation. |
quaternion |
An optional json array containing one to four expressions, corresponding to X, Y, Z, and W quaternion rotation values. |
axisAngle |
An optional json array containing one to four expressions, corresponding to X, Y, Z, and angle axis-angle rotation. |
mcRotationMode |
An optional boolean that defaults to false. If true, applies the XYZ Euler rotation the same way as Minecraft Java Edition blockstate files. Only applies XY rotation. |
uvLock |
An optional boolean that defaults to false. Requires mcRotationMode to be true. If true, the XYZ Euler rotation will counter-rotate the textures so that they remain the same. |
scale |
An optional json array containing one to three expressions, corresponding to X, Y, and Z scale. |
pivot |
An optional json array containing one to three expressions, corresponding to X, Y, and Z pivot around which to rotate and scale. It defaults to (8, 8, 8). A standard block has bounds (0, 0, 0) to (16, 16, 16). |
A model element is a json object representing a cube, similar to an element in Minecraft Java Edition model files. It defines the following keys:
| key | description |
|---|---|
from |
A json array containing one to three expressions, corresponding to X, Y, and Z starting position of the cube. |
to |
A json array containing one to three expressions, corresponding to X, Y, and Z ending position of the cube. |
entityUVs |
An optional json array containing four expressions, corresponding to minU, minV, maxU, and maxV bounding box of the UVs of the cube laid out as would be for entities. If not defined, UVs are generated based on coordinates of the cube. |
rotation |
An optional json object defining the rotation of this element. It is defined below. |
texture |
An optional expression that evaluates to the texture variable name to use for the faces of this cube. |
shadingMode |
An optional expression that evaluates to the shading mode to use for the faces of this cube. |
tintcolor |
An optional expression that evaluates to a list of three floats that is the vertex colour to apply to the faces of this cube. |
faces |
An optional json object with the faces of this cube. If not defined, adds all faces of the cubes with the default values. If defined, it adds in the faces defined in this json object. If a face is left out, it won't add it in. The keys refer to the direction of the face, which can be up, down, top, bottom, north, south, east, and west. up and top, and down and bottom, are aliases of each other. The values are model element faces, defined below. |
The rotation json object defines the following keys:
| key | description |
|---|---|
origin |
An optional json array containing one to three expressions, corresponding to X, Y, and Z pivot around which to rotate. By default it is (8, 8, 8) |
axis |
A string defining the axis around which to rotate. May only be x, y, or z. |
angle |
An expression outputting the angle in degrees to rotate by. |
rescale |
An optional boolean that defaults to false. If true, it scales the face based on the rotation, so that when looking at it head-on it remains the same size. |
The face json object defines the following keys:
| key | description |
|---|---|
uv |
An optional json array containing four expressions, corresponding to minU, minV, maxU, and maxV of the UVs of the face. If not defined, the UVs are based on either the face's position or the entityUVs if that was defined. |
texture |
An optional expression that evaluates to the texture variable name to use for the face of this cube. If not defined, defaults to the texture specified by texture in the model element that this face belongs to. |
shadingMode |
An optional expression that evaluates to the shading mode name to use for the face of this cube. If not defined, defaults to the shading mode specified by shadingMode in the model element that this face belongs to. Otherwise, defaults to "standard". |
tintcolor |
An optional expression that evaluates to a list of three floats that is the vertex colour to apply to the face of this cube. If not defined, defaults to the tint colour specified by tintcolor in the model element that this face belongs to. |
rotation |
An optional expression that evaluates to the rotation of the texture in degrees. |
affineRotation |
An optional boolean that defaults to false. If true, the rotation on the texture is done by rotating the UV coordinates around the centre of the face. If false, the rotation on the texture is done by cycling through the UV coordinates between the vertices of the face, which is always done in multiples of 90 degrees and only works for positive rotations. |
tintindex |
The tint index for the face. |
A generator is a module that generates a model or part of a model. MiEx comes with some predefined models, but a model file can also define its own custom generators to be used.
Object model parts can define the key generators, which is either a json object or a json array of json objects. Each json object is a generator call. The json object has two keys: type is the name of the generator and args is an optional json object of arguments to pass along to the generator. The keys of the arguments json object are the names of the arguments and the values are expressions that are evaluated to yield the values of the arguments.
When a generator is called, it can then output model data.
In the root of the model format, the key generators can be used to define custom generators. generators defines a json object where the keys are the names of the generators and the values are the custom generators themselves. Each custom generator is a model part. Whenever a custom generator is called, it creates a new expression context based on the current expression context and adds the arguments passed to the generators to the new expression context as variables. The model parts of the custom generator can then use those variables.
Because custom generators run in their own expression context, any variables that they define or change will not show up outside of the generator. But, since the expression context is based on the current expression context when called, it can read the variables of the main expression context.
The model generator outputs the model of a given model resource identifier. It's arguments are as follows:
| name | description |
|---|---|
model |
The resource identifier of the model to output. |
doubleSided |
Whether or not the model should be double sided. Defaults to false. |
tints |
A list of colours. If a face's tintindex is a valid index in the list, then the colour in the list is applied to the face and the face's tintindex is set to -1. A colour can either be an integer representing an sRGB colour or a list of three floats representing a linear RGB colour. |
The entity generator outputs the model of a given entity. It's arguments are as follows:
| name | description |
|---|---|
id |
The id of the entity. |
properties |
The properties of the entity. |
The block generator outputs the model of a given block. It's arguments are as follows:
| name | description |
|---|---|
name |
The id of the block. |
properties |
The properties of the block. |
x |
The x position of the block. This might be needed when a block is location dependent or a block makes use of biome colours. |
y |
The y position of the block. This might be needed when a block is location dependent or a block makes use of biome colours. |
z |
The z position of the block. This might be needed when a block is location dependent or a block makes use of biome colours. |
The item generator outputs the model of a given item. It's arguments are as follows:
| name | description |
|---|---|
id |
The id of the item. |
properties |
The properties of the item. |
displayContext |
The display context containing the transformation to apply to the item model. |
The attachment generator outputs the model of a given attachment. It's arguments are as follows:
| name | description |
|---|---|
id |
The id of the attachment, typically an item id. |
properties |
The properties of the item. |
location |
The attachment location for which to return the model. Possible values are none, head, body, leftShoulder, rightShoulder, leftLeg, rightLeg, leftHand, and rightHand
|
The entityAttachment generator outputs the model of a given attachment. It's arguments are as follows:
| name | description |
|---|---|
slot |
The name of the entity's equipment slot in which to look for the item to use for the attachment. |
location |
The attachment location for which to return the model. Possible values are none, head, body, leftShoulder, rightShoulder, leftLeg, rightLeg, leftHand, and rightHand
|
The modelTextures generator adds the texture variables from the model of a given model resource identifier to the current model. This generator will also store the tint indices of faces associated with each texture variable (after remapping and applying the prefix) to global.RefTintIndices.<tex var>. This can be used to also copy over the tint indices of faces from models. It's arguments are as follows:
| name | description |
|---|---|
model |
The resource identifier of the model to output. |
prefix |
A prefix to add to the texture variable names. |
remap |
If specified, remaps all texture variables to this name (prefix still gets applied). |
remap_<name> |
If specified, remap the texture variable of this name to a new name (prefix still gets applied). |
The blockTextures generator adds the texture variables from the model of a given block to the current model. This generator will also store the tint indices of faces associated with each texture variable (after remapping and applying the prefix) to global.RefTintIndices.<tex var>. This can be used to also copy over the tint indices of faces from blocks. It's arguments are as follows:
| name | description |
|---|---|
name |
The id of the block. |
properties |
The properties of the block. |
x |
The x position of the block. This might be needed when a block is location dependent or a block makes use of biome colours. |
y |
The y position of the block. This might be needed when a block is location dependent or a block makes use of biome colours. |
z |
The z position of the block. This might be needed when a block is location dependent or a block makes use of biome colours. |
prefix |
A prefix to add to the texture variable names. |
remap |
If specified, remaps all texture variables to this name (prefix still gets applied). |
remap_<name> |
If specified, remap the texture variable of this name to a new name (prefix still gets applied). |
The map generator outputs the model of a map. It's arguments are as follows:
| name | description |
|---|---|
properties |
The properties of the item from which it gets the map id. It typically looks for a tag compound in which there is either map or map_uuid or a components compound in which there is minecraft:map_id. |
The painting generator outputs the model of a painting. It's arguments are as follows:
| name | description |
|---|---|
properties |
The properties of the entity from which it gets the painting id. It typically looks for a Motive value or variant value / compound. |
The text generator outputs text. It's arguments are as follows:
| name | description |
|---|---|
text |
The text to output. |
font |
The font resource identifier to use. Defaults to minecraft:default. |
textOffsetX |
The x translation of the text. |
textOffsetY |
The y translation of the text. |
textOffsetZ |
The z translation of the text. |
textScale |
The scale of the text. |
textRotateY |
The y rotation of the text. |
color |
The colour of the text. It's either a list of floats or a dictionary containing r, g, b floats. |
glowColor |
The glow colour of the text. It's either a list of floats or a dictionary containing r, g, b floats. |
glowing |
A boolean indicating whether the text should be glowing. |
shadingMode |
A string specifying the shading mode name for the text. Defaults to "standard" for non-glowing text and "fullbright" for glowing text. |
The signText generator outputs text that is found on signs. It's arguments are as follows:
| name | description |
|---|---|
state |
The block properties of the sign from which it gets the text. |
font |
The font resource identifier to use. Defaults to minecraft:default. |
textOffsetX |
The x translation of the text. |
textOffsetY |
The y translation of the text. |
textOffsetZ |
The z translation of the text. |
textOffsetZBack |
The z translation of the text for the back side of the sign. |
textScale |
The scale of the text. |
lineDistance |
The distance between the different lines of text. |
shadingMode |
A string specifying the shading mode name for the text. Defaults to "standard" for non-glowing text and "fullbright" for glowing text. |
In the root of the model format, the key functions can be used to define custom functions. functions is a json object where the keys are the names of the functions and the values are expressions (either as a string or as a json array of strings to easily be able to do multiple lines of code).
The expression of a value may return a value. Arguments can be passed along to the function, which are then available as variables in the name arg0, arg1, arg2, etc. Functions are evaluated in their own expression context, meaning that any variables defined or modified in the function won't show up outside of the function.
Functions can be called using the normal function call syntax and they are available in the global scope, just like variables.
This format contains its own expression language. It is relatively simple, but still powerful. Expressions are defined as strings which are then parsed. Json numbers and booleans are also allowed for ease of use. Each expression performs some work and returns a value. A "multi expression" is a list of expressions that are evaluated and it returns the value of the last expression. When a json string is parsed into an expression, it is parsed into a multi expression. Within a multi expression, each expression is terminated by a semicolon (;).
An expression is built up of multiple expression parts:
Constants or literals are expression parts that represent some value. There are different kinds of constants:
Integer constants are defined by specifying the digits of the integer, with an optional minus sign in front of it for negative numbers. Integers can also be defined with hexadecimal notation using 0x and then the digits or 0b for binary notation.
Float constants are defined by specifying the digits of the whole part (optional), a dot, and then the digits of the fractional part, with an optional minus sign in front of it for negative numbers.
Boolean constants are defined by true or false.
Null constants are defined by null
String constants are defined by the characters encompassed with a single or double quotation mark: 'Hello World!' "Hello World!".
Since expressions are always json strings, when you want to have a value be some string constant, you need to add in the quotation marks. The json data "texture": "#up" would result in a syntax error since the value is parsed as an expression. The correct way would be "texture": "'#up'" (note the single quotation marks.
Dictionaries are like json objects. They start with an open curly brace { and end with a close curly brace }. Each entry is a name specified as a constant, a colon :, and then the value which is parsed as an expression itself. The entries are separated with commas ,.
Arrays are like json arrays. They start with an open bracket [ and end with a close bracket ]. Each element is a value that is parsed as an expression itself and separated with commas ,.
Brackets () can be used to group expression parts in order to enforce a specific evaluation order. Unlike other expression languages, this language always evaluates from left to right, rather than following some order of operations. Therefore, when multiple operations are in a single expression, it is always recommended to make use of brackets so that you know it gets evaluated as intended.
Operators take in some number of values (potentially defined as subexpressions / expression parts) and applies some operation on them.
The not operator starts out with an exclamation mark ! and then some subexpression. It will evaluate that subexpression into a boolean value and return the inverse of the boolean value.
The equal operator is two equal signs == which takes the subexpression to the left and compares its evaluated value to the evaluated value of the subexpression to the right, returning a boolean value based on whether they are equal.
Same as equal operator but then != and returns the opposite of the equal operator.
Similar to equal operator but then > and returns whether the value on the left is greater than the value on the right.
Similar to equal operator but then < and returns whether the value on the left is less than the value on the right.
Similar to equal operator but then >= and returns whether the value on the left is greater than or equal to the value on the right.
Similar to equal operator but then <= and returns whether the value on the left is less than or equal to the value on the right.
Similar to equal operator but then && and returns whether both the value on the left and on the right evaluate to true.
Similar to equal operator but then || and returns whether either the value on the left or the value on the right evaluates to true.
The plus operator is a single plus + which takes the subexpression to the left and adds its evaluated value to the evaluated value of the subexpression to the right, returning the resulting value.
Similar to the plus operator but then - and subtracts the value on the right from the value on the left.
Similar to the plus operator but then * and multiplies the two values together.
Similar to the plus operator but then / and divides the value on the left by the value on the right.
The assignment operator is a single equal sign = and sets the value of the subexpression on the left side to the evaluated value of the subexpression on the right side. This can be used to set variables.
There are also variants of the assignment operators that combine the arithmetic operators (+=, -=, *=, and /=) which runs the arithmetic operators on the existing value and the new value and assigns the resulting value.
The ternary operator is made up of three parts. A condition subexpression, then a question mark ?, the value to return if the condition is true, a colon :, and then the value to return if the condition is false. The values can also be subexpressions to be evaluated. It will only evaluate one of the two subexpressions.
Data stored in arrays and dictionaries can be accessed using the access operator, which is square brackets with the key inside of it [<key>]. The key can be a constant or a subexpression to evaluate. For arrays it should evaluate to an integer (or string holding an integer). For objects, it is the key string value. This operator then accesses the element or entry corresponding to the key in the value on the left of the operator.
Functions can be called using the call operator, which is parentheses with optional arguments inside () or (<arg0>, <arg1>, <arg2>). Each argument can be a constant or a subexpression to evaluate. This operator then calls the function defined by the value on the left of the operator.
Some values may have members, which can be values or functions (functions are technically also values). Members of a value can be accessed using the member operator, which is a dot .. The value is on the left of the operator and the member name is on the right of the operator.
When evaluating a multi expression, the return operator can be used to stop evaluation prematurely and to have it return the value specified to the right of the return operator. The return operator is defined as return <return value>.
Variables and functions can be accessed by specifying their names. If none exists by that name, then a new variable is declared with that name. There are a few global variables are predefined.
A value can be of a few different types, storying different kinds of data. Values are implicitly converted to different types as needed.
The null type is a value holding no data.
The int type is a value holding a 64 bit integer.
The float type is a value holding a floating point number.
The bool type is a value holding a boolean.
The string type is a value holding a string. String can be concatenated using the + operator. It also defines a couple of member functions:
| name | description |
|---|---|
length() |
The number of characters in the string. |
startsWith(<string> |
Whether the string starts with the string value provided. |
endsWith(<string>) |
Whether the string ends with the string value provided. |
equalsIgnoreCase(<string>) |
Whether the string equals the string value provided ignoring the case of the strings. |
contains(<string>) |
Whether the string contains the string value provided. |
containsIgnoreCase(<string>) |
Whether the string contains the string value provided ignoring the case of the strings. |
indexOf(<string>) |
The index at which the string value provided is found in the string. |
lastIndexOf(<string>) |
The last index at which the string value provided is found in the string. |
replace(<string, <string>) |
Replaces all instances of the first string with the second string, returning a new string. |
substring(<int>, <int>) |
Returns a new string containing the substring starting from the first integer index and ending at the second integer index. |
toLowerCase() |
Returns the string converted into lower case. |
toUpperCase() |
Returns the string converted into upper case. |
The dictionary type is a value holding key/value pairs. When a member is accessed using either the access operator or member operator it returns the value of the key/value pair that matches the access key or member name. If no key/value pair is found, one is created.
Arrays are internally represented as dictionaries.
The function type represents a function that can be called with optional arguments passed along, which may return some value.
The block type is a type representing a block. It contains the following members:
| name | description |
|---|---|
name |
The id of the block. |
state |
A dictionary of the block properties of the block. |
x |
The integer x coordinate of the block. |
y |
The integer y coordinate of the block. |
z |
The integer z coordinate of the block. |
The thisBlock type is a global variable named thisBlock which holds data about the block for which the blockstate file is currently evaluated for. It contains the following members:
| name | description |
|---|---|
name |
The id of the block. |
state |
A dictionary of the block properties of the block. |
x |
The integer x coordinate of the block. Only accessible if the block is location dependent. |
y |
The integer y coordinate of the block. Only accessible if the block is location dependent. |
z |
The integer z coordinate of the block. Only accessible if the block is location dependent. |
fx |
The floating point x coordinate of the block. Only accessible if the block is location dependent. |
fy |
The floating point x coordinate of the block. Only accessible if the block is location dependent. |
fz |
The floating point x coordinate of the block. Only accessible if the block is location dependent. |
pitch |
The pitch of the block or entity. |
yaw |
The yaw of the block or entity. |
time |
The current animation time in seconds. Defaults to 0 if this block isn't animated. |
The thisEntity type is a global variable named thisEntity which holds data about the entity for which the entity file is currently evaluated for. It is an alias for thisBlock.
The thisAttachment type is a global variable named thisAttachment which holds data about the attachment for which the attachment file is currently evaluated for. It is an alias for thisBlock.
The globals type is a global variable named globals which is a dictionary that is accessible in all expression contexts and can be used to store variables that should be accessible and modifiable in generators and functions (which get their own expression contexts).
The Math type is a global variable named Math which contains member functions for different math operations:
| name |
|---|
abs(<number>) |
acos(<number>) |
asin(<number>) |
atan(<number>) |
atan2(<number>, <number>) |
ceil(<number>) |
clamp(<number> value, <number> min, <number> max) |
cos(<number>) |
cosh(<number>) |
exp(<number>) |
floor(<number>) |
log(<number>) |
log10(<number>) |
max(<number>, <number>) |
min(<number>, <number>) |
pow(<number>, <number>) |
round(<number>) |
signum(<number>) |
sin(<number>) |
sinh(<number>) |
sqrt(<number>) |
tan(<number>) |
tanh(<number>) |
toDegrees(<number>) |
toRadians(<number>) |
The Dict type is a global variable named Dict which contains member functions for different dictionary operations:
| name | description |
|---|---|
length(<dictionary>) |
Returns the number of entries in the dictionary or array. |
hasKey(<dictionary>, <string>) |
Returns a boolean of whether the dictionary or array has the key / index. |
keys(<dictionary>) |
Returns an array of the keys of the dictionary. |
The Block type is a global variable named Block which contains member functions for different block lookups:
| name | description |
|---|---|
getBlockRelative(<int> x, <int> y, <int> z, <int> layer) |
Returns a block value of the block found at the specific x, y, and z offset relative to the current block or entity. MiEx's internal chunk format supports multiple layers, allowing multiple blocks to exist in the same location. Which layer to check can be specified. This function is only allowed to be called if the block or entity is location dependent. |
blockHasTag(<block>, <string>) |
Returns true if the block is part of the specified tag. |
The Value type is a global variable named Value which contains member functions for different value operations:
| name | description |
|---|---|
getType(<value>) |
Returns a string of the type name of the given value. |
The Textures type is a global variable named Textures which contains member functions for different texture operations:
| name | description |
|---|---|
getTextureForPlayerProfile(<value>) |
Finds the player skin matching the provided value and returns the texture resource identifier for it. The value could be a player name or a dictionary containing the name key or id key (for uuid) or item data of a skull. |
getDyeTintColor(<item>) |
Reads the item properties to find a dye component and returns a list of three floats corresponding to the RGB colour of that dye. |
intToRGB(<int) |
Converts an integer specifying a 24 bit RGB colour in sRGB into a list of three floats corresponding to the RGB colour. |