Class ModelHelper
java.lang.Object
net.fabricmc.fabric.api.renderer.v1.model.ModelHelper
Collection of utilities for model implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ModelTransformationMimics the vanilla model transformation used for most vanilla blocks, and should be suitable for most custom block-like models.static final intResult fromtoFaceIndex(Direction)for null values.static final Transformationstatic final Transformationstatic final Transformationstatic final Transformationstatic final Transformationstatic final Transformation -
Method Summary
Modifier and TypeMethodDescriptionstatic DirectionfaceFromIndex(int faceIndex) Use to decode a result fromtoFaceIndex(Direction).static inttoFaceIndex(Direction face) Convenient way to encode faces that may be null.toQuadLists(Mesh mesh) Converts a mesh into an array of lists of vanilla baked quads.
-
Field Details
-
NULL_FACE_ID
public static final int NULL_FACE_IDResult fromtoFaceIndex(Direction)for null values.- See Also:
-
TRANSFORM_BLOCK_GUI
-
TRANSFORM_BLOCK_GROUND
-
TRANSFORM_BLOCK_FIXED
-
TRANSFORM_BLOCK_3RD_PERSON_RIGHT
-
TRANSFORM_BLOCK_1ST_PERSON_RIGHT
-
TRANSFORM_BLOCK_1ST_PERSON_LEFT
-
MODEL_TRANSFORM_BLOCK
Mimics the vanilla model transformation used for most vanilla blocks, and should be suitable for most custom block-like models.
-
-
Method Details
-
toFaceIndex
Convenient way to encode faces that may be null. Null is returned asNULL_FACE_ID. UsefaceFromIndex(int)to retrieve encoded face. -
faceFromIndex
Use to decode a result fromtoFaceIndex(Direction). Return value will be null if encoded value was null. Can also be used for no-allocation iteration ofDirection.values(), optionally including the null face. (Use < or <=NULL_FACE_IDto exclude or include the null value, respectively.) -
toQuadLists
Converts a mesh into an array of lists of vanilla baked quads. Useful for creating vanilla baked models when required for compatibility. The array indexes correspond toDirection.getId()with the addition ofNULL_FACE_ID.Retrieves sprites from the block texture atlas via
SpriteFinder.
-