Skip to content

Instantly share code, notes, and snippets.

@RainWarrior
Last active March 3, 2021 23:15
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save RainWarrior/0618131f51b8d37b80a6 to your computer and use it in GitHub Desktop.
Save RainWarrior/0618131f51b8d37b80a6 to your computer and use it in GitHub Desktop.
<blockstate> == {
"forge_marker": 1,
"defaults": <variant>, // optional, added to all variants
"variants": {
"<property>": {
"<value>": <variant> // variant definition for the specified value of this property; variants for multiple values can be specified.
},
"<variant name>": <variant>, // variant definition for the full variant string
"<variant name>": [<variant1>, ...], // array of definitions for the full variant - result will be the random variant
}
}
<variant> == {
"model": "<model location>",
"textures": { // remaps the <from> texture in the model to <to>; multiple remappings can be specified
"<from>": "<to>"
},
"x": <angle-90>, // vanilla rotation compatibility; only multiples of 90 degrees are supported, see vanilla specification
"y": <angle-90>,
"transform": <root-transform>, // transformations
"uvlock": <bool>, // see vanilla specification
"weight": <int>, // random weight, see vanilla specification
// submodels: all stuff specified will be merged into the base model. If this is the root variant without the model - base will be chosen from one of the submodels.
"submodel": "<model location>",
"submodel": <variant>,
"submodel": [<variant>, ...],
"custom": { "<key>": <value> } // custom data that models can use
}
<root-transform> == <transform>
<root-transform> == {
"thirdperson": <transform>,
"firstperson": <transform>,
"gui": <transform>,
"head": <transform>,
// or any of the <transform> keys
}
<transform> == "<builtin string>"
currently supported builtin strings:
"identity" - identity transformation
"forge:default-block" - default block transformation (example: stone)
"forge:default-item" - default 2d item transformation (example: bucket)
"forge:default-tool" - default 2d tool transformation (example: pickaxe)
This may be expanded to something more generic in the future.
<transform> == <matrix>
<transform> == { "matrix": <matrix> }
<matrix> == [
[<number>, <number>, <number>, <number>],
[<number>, <number>, <number>, <number>],
[<number>, <number>, <number>, <number>]
]
4x3 matrix (3x3 affine part + translation column)
<transform> == {
// all keys are optional
"translation": [<number>, <number>, <number>],
"rotation": <rotation>,
"scale": [<number>, <number>, <number>], // per-axis scale
"scale": <number>, // uniform scale
"post-rotation": <rotation>
}
<rotation> == [<number>, <number>, <number>, <number>]
Quaternion(x, y, z, w)
<rotation> == {"<axis>": <number>}
Rotation around the coordinate axis, in degrees. Value is unrestricted
<rotation> == [{"<axis1>": <number>}, ...]
Composition of rotations around multiple axes, in the specified order
@Maaxed
Copy link

Maaxed commented Jul 7, 2018

The <variant> object can also have the property "gui3d": <bool> (same effect as IBakedModel::isGui3D) and the property "smooth_lighting": <bool> (that replaces "ambientocclusion" in vanilla models)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment