Basic Types
See also: Conditions, Ingredients, Results and Predicates.
This page covers many commonly used JSON elements that show up in a variety off formats in data packs or resource packs.
Resource Location
String representing the registry name of an object in the game. Format is always <domain>:<name>
, where <domain>
typically represents a mod or datapack ID, and <name>
is the specific name for this object. Valid characters are any lowercase letter, any number, -
, _
, and /
. A single :
is allowed between the domain and name.
Note that when creating new content, it is always advised to use a custom domain for your content over that of an existing mod such as tconstruct
to minimize potential for conflict and to properly show the user the source of the content.
Registry IDs
A common application of resource locations is an ID of a value in a registry. Unlike regular resource locations, registry IDs are often validated against the registry contents to ensure a matching ID exists.
Tag Name
See also the Minecraft Wiki article on tags
Another common application of resource locations is an ID of a tag for a registry. Tags typically exist under data/<domain>/tags/<registry name>/<name>.json
, though material and modifier tags exist under data/<domain>/tinkering/tags/<materials|modifiers>/<name>.json
.
For JSON tag fields, if the requested tag does not exist the behavior is the same as if the tag is empty.
Pattern
Another application of resource locations is patterns, which are used as part of the part builder. When defining a pattern <domain>:<name>
, it will be translated with the tooltip from pattern.<domain>.<name>
, and will be rendered with an icon from assets/<domain>/textures/gui/tinker_pattern/<name>.png
. For instance, the pattern tconstruct:ingot
uses the tooltip pattern.tconstruct.ingot
and the texture assets/tconstruct/textures/gui/tinker_pattern/ingot.png
.
Color
Many JSON contain colors expressed as 6 or 8 digit hex color strings. 6 digit RGB strings use the format of "RRGGBB"
, while 8 digit ARGB strings use the format of "AARRGGBB"
. AA
, RR
, GG
, and BB
are hex numbers between 0 (00
) and 255 (FF
) representing the intensity of the color in (case insensitive) hexadecimal, with higher values meaning more of that color is present. On ARGB strings, if only 6 digits are provided then AA
is set to 255.
For example, "FF00000"
represents a bright red, as RR
is 255 and both GG
and BB
are 0. If this was an ARGB color, then AA
would be set to 255 (fully opaque).
Text Color
Some JSON formats are deserialized using “text color”, which is a variant of RGB colors that also supports parsing named colors. Text colors are parsed using the format of "#RRGGBB"
, which is the same format as the 6 digit RGB string, except with a leading #
character. In addition, text colors support the following named colors:
Name | Value |
---|---|
black |
"#000000" |
dark_blue |
"#0000AA" |
dark_green |
"#00AA00" |
dark_aqua |
"#00AAAA" |
dark_red |
"#AA0000" |
dark_purple |
"#AA00AA" |
gold |
"#FFAA00" |
gray |
"#AAAAAA" |
dark_gray |
"#555555" |
blue |
"#5555FF" |
green |
"#55FF55" |
aqua |
"#55FFFF" |
red |
"#FF5555" |
light_purple |
"#FF55FF" |
yellow |
"#FFFF55" |
white |
"#FFFFFF" |
Tool Action
A tool action is a registry defined by Forge for behaviors that a tool may perform. Unlike item tags, tool actions may be NBT sensitive. Tool action in JSON are simply string values, though any associated behavior typically needs to be defined in code.
For a list of tool actions defined by Forge, see the Forge GitHub.
Integer Range
Recipe types working with numbers often make use of the integer range type, which contains a minimum and maximum value in a range. This type can be parsed either as an object or an integer. As an object, an integer range has the following format:
- Minimum value for the range. If unset, defaults to the minimum value for the given context.
- Maximum value for the range. If unset, defaults to the maximum value for the given context.
The integer range object.
For an integer range to be valid, max
must be greater than or equal to min
. In the integer format, an integer range behaves as follows:
- The exact value to match.
This is equivalent to setting both min
and max
to the same value.
Block State Variant
A block state variant is a string representation of a set of properties for a block state, notably used in the block state format.
A block state variant is a string containing a comma separated list of <property>=<value>
pairs, where <property>
is the name of a property on the block and <value>
is a string representation of a value. The string does not need to contain every property on the block, only the ones the variant is used to match.
For example, the string "facing=north,color=red"
would match a block with a property color
set to red
and a property facing
set to north
. Alternatively, ""
will match all variants of the block.
Vector
A vector is a list of 3 integer values representing a coordinate, such as a world position or a location within a block model. They have the following format in JSON:
- First index representing the X value.
- Second index representing the Y value.
- Third index representing the Z value.
A vector.
Alternatively, in many contexts a vector may also be specified in object format:
- The X value.
- The Y value.
- The Z value.
A vector.
Direction
A direction is an enumeration of values used commonly for orientations in block models, commonly represented as a string. It has the following possible values:
down
: Represents a negative direction on the Y axis.up
: Represents a positive direction on the Y axis.north
: Represents a negative direction on the Z axis.south
: Represents a positive direction on the Z axis.west
: Represents a negative direction on the X axis.east
: Represents a positive direction on the X axis.