Overview of Models
This page describes the basics of models. Forge allows mods to extend the vanilla model format by adding custom model loaders which can have dynamic behavior. These loaders will replace certain but not all elements of the vanilla model format.
Model loaders
Forge allows mods to register custom model loaders, which are specified in JSON using the loader
field. These loaders will typically ignore the default elements
field in the JSON, and are free to either use or ignore the textures
field. However, most model formats defined in Mantle and Tinkers’ Construct reimplement the standard model format making the behavior close to vanilla.
Model loaders generally do not change the behavior of of ambientocclusion
,gui_light
, display
, or overrides
from the vanilla model format.
Simple Block Model
Simple block model is a utility in Mantle that allows our custom models to process element data from the parent
, along with parse elements
from the current model more easily. In other words, it makes the core of the model behave identically to a vanilla model, causing all behavior to just be added on top.
Simple block models provide the following fields in JSON:
- If set, will load elements and textures from the given parent if they are not in the current model.
[0, 0, 0]
.
Start of the element in pixels. A full cube would start at [16, 16, 16]
.
End of the element in pixels. A full cube would end at - Center of the rotation.
x
,y
, orz
.
Specifies the direction of rotation. May be - Rotation angle in degrees, must be -45, -22.5, 0, 22.5, or 45.
- If true, the model faces will be rescaled after rotation to fit across the full block.
Rotates the element on the given axis and origin. If unset, does not rotate.
- If true (default), shadows are rendered.
- direction to face data. Map of face
- direction values.
- If a solid block is placed this direction from the model, this face will not render. If unset, the face never culls.
- Color index from the block color getter to fetch to dynamically color the face. If unset, face will not be dynamically tinted.
textures
to use on this face.
Name of a texture from [ minU, minV, maxU, maxV ]
. Values typically range from 0 to 16, where 0 is the top left corner.
Array of UV values in the order - Additional settings for this element from Forge. Overrides the element forge data.
- Minimum light level for the face between 0 and 15. Defaults to 0.
A single face. Key is one of six - Additional settings for this element from Forge. Will be overridden by values from the face.
An element object.
List of elements to use. If unset, will load elements from the parent.
The simple block model.
Vector coordinates and UV coordinates are in pixel values (that is, 1/16 of a block).
Forge Face Data
Since 1.20, Forge allows defining custom data on both a model element and an element face. The data has the following format:
FFFFFFFF
(white, that is no tint).
Color to tint the element/face. Defaults to - Minimum block light level for the element/face between 0 and 15. Defaults to 0.
- Minimum sky light level for the element/face between 0 and 15. Defaults to 0.
ambientocclusion
for a specific block element/face.
Allows overriding - If true, manually calculates the normals for this element/face instead of inheriting facing normals like vanilla. Defaults to false.
Defines additional data from Forge. If unset, behaves the same way as an empty object.
Colored Block Model
Many model formats from Mantle and Tinkers’ Construct support additional data to change the color of a model face. This is implemented both in utilities made available to other model loaders, and through the mantle:colored_block
loader registered by Mantle. Colored block models add the following to the [simple block model]
(#simple-block-model) format:
- All fields from Simple Block Model.
elements
. If an element has no index in this array it gets the default behavior for all fields.FFFFFFFF
(white, that is no tint).
Color to tint the element/face. Defaults to - Minimum light level for the element between 0 and 15. Defaults to 0.
- If set, overrides the UV lock setting from the block state JSON for this element.
A color data entry. Index of the entry corresponds to an index in
Array of additional data for each element in the block model.
The colored block model.
Note that due to Forge implementing many similar features to this in 1.20, there is a good chance the model loader for colored block models is removed in a later version.