Class ExtendedModelTemplateBuilder
java.lang.Object
net.neoforged.neoforge.client.model.generators.template.ExtendedModelTemplateBuilder
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) @Nullable Boolean
(package private) @Nullable CustomLoaderBuilder
(package private) final List
<ElementBuilder> (package private) net.minecraft.client.resources.model.UnbakedModel.GuiLight
(package private) Optional
<net.minecraft.resources.ResourceLocation> (package private) @Nullable net.minecraft.resources.ResourceLocation
(package private) final Set
<net.minecraft.client.data.models.model.TextureSlot> (package private) final RootTransformsBuilder
(package private) final Map
<net.minecraft.world.item.ItemDisplayContext, TransformVecBuilder> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionambientOcclusion
(boolean ambientOcclusion) Sets whether or not this model should apply ambient occlusion.build()
Finalizes this builder into a compiledModelTemplate
.static ExtendedModelTemplateBuilder
builder()
<L extends CustomLoaderBuilder>
ExtendedModelTemplateBuildercustomLoader
(Supplier<L> customLoaderFactory, Consumer<L> action) Use a custom loader instead of the vanilla elements.element
(int index, Consumer<ElementBuilder> action) Get an existing element builderelement
(Consumer<ElementBuilder> action) Creates a new element for this model while also allowing mutation.int
Returns the number of elements in this model builder.guiLight
(net.minecraft.client.resources.model.UnbakedModel.GuiLight light) Sets the gui light style for this model.static ExtendedModelTemplateBuilder
of
(net.minecraft.client.data.models.model.ModelTemplate template) parent
(net.minecraft.resources.ResourceLocation parent) Parent model which this template will inherit its properties from.renderType
(String renderType) Set the render type for this model.renderType
(net.minecraft.resources.ResourceLocation renderType) Set the render type for this model.requiredTextureSlot
(net.minecraft.client.data.models.model.TextureSlot slot) Marks the givenslot
as required, meaning that it must be specified in the giventexture mappings
.rootTransforms
(Consumer<RootTransformsBuilder> action) Modifies the transformation applied right before item display transformations and rotations specified in block states.Suffix appended onto the models file path.transform
(net.minecraft.world.item.ItemDisplayContext type, Consumer<TransformVecBuilder> action) Begin building a new transform for the given perspective.
-
Field Details
-
parent
Optional<net.minecraft.resources.ResourceLocation> parent -
suffix
-
requiredSlots
-
transforms
-
elements
-
customLoader
-
rootTransforms
-
renderType
@Nullable @Nullable net.minecraft.resources.ResourceLocation renderType -
ambientOcclusion
-
guiLight
@Nullable net.minecraft.client.resources.model.UnbakedModel.GuiLight guiLight
-
-
Constructor Details
-
ExtendedModelTemplateBuilder
public ExtendedModelTemplateBuilder()
-
-
Method Details
-
of
public static ExtendedModelTemplateBuilder of(net.minecraft.client.data.models.model.ModelTemplate template) -
builder
-
parent
Parent model which this template will inherit its properties from. -
suffix
Suffix appended onto the models file path. -
requiredTextureSlot
public ExtendedModelTemplateBuilder requiredTextureSlot(net.minecraft.client.data.models.model.TextureSlot slot) Marks the givenslot
as required, meaning that it must be specified in the giventexture mappings
. -
renderType
Set the render type for this model.- Parameters:
renderType
- the render type. Must be registered viaRegisterNamedRenderTypesEvent
- Returns:
- this builder
- Throws:
NullPointerException
- ifrenderType
isnull
-
renderType
Set the render type for this model.- Parameters:
renderType
- the render type. Must be registered viaRegisterNamedRenderTypesEvent
- Returns:
- this builder
- Throws:
NullPointerException
- ifrenderType
isnull
-
transform
public ExtendedModelTemplateBuilder transform(net.minecraft.world.item.ItemDisplayContext type, Consumer<TransformVecBuilder> action) Begin building a new transform for the given perspective.- Parameters:
type
- the perspective to create or return the builder for- Returns:
- the builder for the given perspective
- Throws:
NullPointerException
- iftype
isnull
-
ambientOcclusion
Sets whether or not this model should apply ambient occlusion. -
guiLight
public ExtendedModelTemplateBuilder guiLight(net.minecraft.client.resources.model.UnbakedModel.GuiLight light) Sets the gui light style for this model.UnbakedModel.GuiLight.FRONT
for head on light, commonly used for items.UnbakedModel.GuiLight.SIDE
for the model to be side lit, commonly used for blocks.
-
element
Creates a new element for this model while also allowing mutation.- Throws:
IllegalStateException
- ifcustomLoader
does not allow inline elements.
-
element
Get an existing element builder- Parameters:
index
- the index of the existing element builder- Returns:
- the element builder
- Throws:
IndexOutOfBoundsException
- if index is out of bounds
-
getElementCount
public int getElementCount()Returns the number of elements in this model builder.- Returns:
- the number of elements in this model builder
-
customLoader
public <L extends CustomLoaderBuilder> ExtendedModelTemplateBuilder customLoader(Supplier<L> customLoaderFactory, Consumer<L> action) Use a custom loader instead of the vanilla elements.- Parameters:
customLoaderFactory
- function that returns the custom loader to set, given this- Returns:
- the custom loader builder
-
rootTransforms
Modifies the transformation applied right before item display transformations and rotations specified in block states. -
build
Finalizes this builder into a compiledModelTemplate
.
-