Class ModelBuilder<T extends ModelBuilder<T>>
java.lang.Object
net.minecraftforge.client.model.generators.ModelFile
net.minecraftforge.client.model.generators.ModelBuilder<T>
- Type Parameters:
T
- Self type, for simpler chaining of methods.
- Direct Known Subclasses:
BlockModelBuilder
,ItemModelBuilder
General purpose model builder, contains all the commonalities between item
and block models.
- See Also:
ModelProvider
,BlockModelBuilder
,ItemModelBuilder
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
static class
static class
class
Nested classes/interfaces inherited from class net.minecraftforge.client.model.generators.ModelFile
ModelFile.ExistingModelFile, ModelFile.UncheckedModelFile
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected CustomLoaderBuilder
protected List<ModelBuilder.ElementBuilder>
protected ExistingFileHelper
protected BlockModel.GuiLight
protected ModelFile
protected ModelBuilder.TransformsBuilder
-
Constructor Summary
ModifierConstructorDescriptionprotected
ModelBuilder(ResourceLocation outputLocation, ExistingFileHelper existingFileHelper)
-
Method Summary
Modifier and TypeMethodDescriptionao(boolean ao)
<L extends CustomLoaderBuilder<T>>
LcustomLoader(BiFunction<T,ExistingFileHelper,L> customLoaderFactory)
Use a custom loader instead of the vanilla elements.element()
element(int index)
Get an existing element builderprotected boolean
exists()
int
Gets the number of elements in this model buildergui3d(boolean gui3d)
Deprecated.guiLight(BlockModel.GuiLight light)
Set the parent model for the current model.private T
self()
private Number
serializeFloat(float f)
private String
serializeLocOrKey(String tex)
private com.google.gson.JsonArray
serializeVector3f(Vector3f vec)
Set the texture for a given dictionary key.texture(String key, ResourceLocation texture)
Set the texture for a given dictionary key.com.google.gson.JsonObject
toJson()
Methods inherited from class net.minecraftforge.client.model.generators.ModelFile
assertExistence, getLocation, getUncheckedLocation
-
Field Details
-
parent
-
textures
-
transforms
-
existingFileHelper
-
ambientOcclusion
protected boolean ambientOcclusion -
guiLight
-
elements
-
customLoader
-
-
Constructor Details
-
ModelBuilder
-
-
Method Details
-
self
-
exists
protected boolean exists() -
parent
Set the parent model for the current model.- Parameters:
parent
- the parent model- Returns:
- this builder
- Throws:
NullPointerException
- ifparent
isnull
IllegalStateException
- ifparent
does notexist
-
texture
Set the texture for a given dictionary key.- Parameters:
key
- the texture keytexture
- the texture, can be another key e.g."#all"
- Returns:
- this builder
- Throws:
NullPointerException
- ifkey
isnull
NullPointerException
- iftexture
isnull
IllegalStateException
- iftexture
is not a key (does not start with'#'
) and does not exist in any known resource pack
-
texture
Set the texture for a given dictionary key.- Parameters:
key
- the texture keytexture
- the texture- Returns:
- this builder
- Throws:
NullPointerException
- ifkey
isnull
NullPointerException
- iftexture
isnull
IllegalStateException
- iftexture
is not a key (does not start with'#'
) and does not exist in any known resource pack
-
transforms
-
ao
-
gui3d
Deprecated.Unused in 1.15, useguiLight(GuiLight)
instead.- Parameters:
gui3d
-- Returns:
- this builder
-
guiLight
-
element
-
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()Gets the number of elements in this model builder- Returns:
- the number of elements in this model builder
-
customLoader
public <L extends CustomLoaderBuilder<T>> L customLoader(BiFunction<T,ExistingFileHelper,L> customLoaderFactory)Use a custom loader instead of the vanilla elements.- Parameters:
customLoaderFactory
-- Returns:
- the custom loader builder
-
toJson
public com.google.gson.JsonObject toJson() -
serializeLocOrKey
-
serializeVector3f
-
serializeFloat
-
guiLight(GuiLight)
instead.