Class UnbakedGeometryHelper
java.lang.Object
net.minecraftforge.client.model.geometry.UnbakedGeometryHelper
Helper for dealing with unbaked models and geometries.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final FaceBakeryprivate static final PatternExplanation: This takes anything that looks like a valid resourcepack texture location, and tries to extract a resourcelocation out of it. 1. it will ignore anything up to and including an /assets/ folder, 2. it will take the next path component as a namespace, 3. it will match but skip the /textures/ part of the path, 4. it will take the rest of the path up to but excluding the .png extension as the resource path It's a best-effort situation, to allow model files exported by modelling software to be used without post-processing.private static final ItemModelGenerator
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic IQuadTransformerapplyRootTransform(ModelState modelState, Transformation rootTransform) Create anIQuadTransformerto apply aTransformationthat undoes theModelStatetransform (blockstate transform), applies the given root transform and then re-applies the blockstate transform.static BakedModelbake(BlockModel blockModel, ModelBaker modelBaker, BlockModel owner, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ResourceLocation modelLocation, boolean guiLight3d) Helper for bakingBlockModelinstances.static BakedQuadbakeElementFace(BlockElement element, BlockElementFace face, TextureAtlasSprite sprite, Direction direction, ModelState state, ResourceLocation modelLocation) Turns a singleBlockElementFaceinto aBakedQuad.bakeElements(List<BlockElement> elements, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ResourceLocation modelLocation) Bakes a list of block elements and returns the list of baked quads.static voidbakeElements(IModelBuilder<?> builder, List<BlockElement> elements, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ResourceLocation modelLocation) Bakes a list of block elements and feeds the baked quads to a model builder.static ModelStatecomposeRootTransformIntoModelState(ModelState modelState, Transformation rootTransform) Returns aModelStatethat combines the existing model state and the root transform.static List<BlockElement>createUnbakedItemElements(int layerIndex, SpriteContents spriteContents) static List<BlockElement>createUnbakedItemElements(int layerIndex, SpriteContents spriteContents, @Nullable ForgeFaceData faceData) Creates a list of block elements in the shape of the specified sprite contents.static List<BlockElement>createUnbakedItemMaskElements(int layerIndex, SpriteContents spriteContents) static List<BlockElement>createUnbakedItemMaskElements(int layerIndex, SpriteContents spriteContents, @Nullable ForgeFaceData faceData) Creates a list of block elements in the shape of the specified sprite contents.static MaterialresolveDirtyMaterial(@Nullable String tex, IGeometryBakingContext owner) Resolves a material that may have been defined with a filesystem path instead of a properResourceLocation.
- 
Field Details- 
ITEM_MODEL_GENERATOR
- 
FACE_BAKERY
- 
FILESYSTEM_PATH_TO_RESLOCExplanation: This takes anything that looks like a valid resourcepack texture location, and tries to extract a resourcelocation out of it. 1. it will ignore anything up to and including an /assets/ folder, 2. it will take the next path component as a namespace, 3. it will match but skip the /textures/ part of the path, 4. it will take the rest of the path up to but excluding the .png extension as the resource path It's a best-effort situation, to allow model files exported by modelling software to be used without post-processing. Example: C:\Something\Or Other\src\main\resources\assets\mymodid\textures\item\my_thing.png ........................................--------_______----------_____________----Result after replacing '\' to '/': mymodid:item/my_thing 
 
- 
- 
Constructor Details- 
UnbakedGeometryHelperpublic UnbakedGeometryHelper()
 
- 
- 
Method Details- 
resolveDirtyMaterialpublic static Material resolveDirtyMaterial(@Nullable @Nullable String tex, IGeometryBakingContext owner) Resolves a material that may have been defined with a filesystem path instead of a properResourceLocation.The target atlas will always be TextureAtlas.LOCATION_BLOCKS.
- 
bake@Internal public static BakedModel bake(BlockModel blockModel, ModelBaker modelBaker, BlockModel owner, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ResourceLocation modelLocation, boolean guiLight3d) Helper for bakingBlockModelinstances. Handles baking custom geometries and deferring item model baking.
- 
createUnbakedItemElementspublic static List<BlockElement> createUnbakedItemElements(int layerIndex, SpriteContents spriteContents) 
- 
createUnbakedItemElementspublic static List<BlockElement> createUnbakedItemElements(int layerIndex, SpriteContents spriteContents, @Nullable @Nullable ForgeFaceData faceData) Creates a list of block elements in the shape of the specified sprite contents. These can later be baked using the same, or another texture.The Direction.NORTHandDirection.SOUTHfaces take up the whole surface.
- 
createUnbakedItemMaskElementspublic static List<BlockElement> createUnbakedItemMaskElements(int layerIndex, SpriteContents spriteContents) 
- 
createUnbakedItemMaskElementspublic static List<BlockElement> createUnbakedItemMaskElements(int layerIndex, SpriteContents spriteContents, @Nullable @Nullable ForgeFaceData faceData) Creates a list of block elements in the shape of the specified sprite contents. These can later be baked using the same, or another texture.The Direction.NORTHandDirection.SOUTHfaces take up only the pixels the texture uses.
- 
bakeElementspublic static void bakeElements(IModelBuilder<?> builder, List<BlockElement> elements, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ResourceLocation modelLocation) Bakes a list of block elements and feeds the baked quads to a model builder.
- 
bakeElementspublic static List<BakedQuad> bakeElements(List<BlockElement> elements, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ResourceLocation modelLocation) Bakes a list of block elements and returns the list of baked quads.
- 
bakeElementFacepublic static BakedQuad bakeElementFace(BlockElement element, BlockElementFace face, TextureAtlasSprite sprite, Direction direction, ModelState state, ResourceLocation modelLocation) Turns a singleBlockElementFaceinto aBakedQuad.
- 
applyRootTransformpublic static IQuadTransformer applyRootTransform(ModelState modelState, Transformation rootTransform) Create anIQuadTransformerto apply aTransformationthat undoes theModelStatetransform (blockstate transform), applies the given root transform and then re-applies the blockstate transform.- Returns:
- an IQuadTransformerthat applies the root transform to a baked quad that already has the transformation of the givenModelStateapplied to it
 
- 
composeRootTransformIntoModelStatepublic static ModelState composeRootTransformIntoModelState(ModelState modelState, Transformation rootTransform) Returns aModelStatethat combines the existing model state and the root transform.- Returns:
- a ModelStatethat combines the existing model state and the root transform
 
 
-