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:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionclassstatic enumclassclassNested classes/interfaces inherited from class net.minecraftforge.client.model.generators.ModelFileModelFile.ExistingModelFile, ModelFile.UncheckedModelFile
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleanprotected CustomLoaderBuilder<T> protected final List<ModelBuilder<T>.ElementBuilder> protected final ExistingFileHelperprotected BlockModel.GuiLightprotected @Nullable ModelFileprotected Stringprivate final ModelBuilder<T>.RootTransformsBuilderprotected final ModelBuilder<T>.TransformsBuilder
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedModelBuilder(ResourceLocation outputLocation, ExistingFileHelper existingFileHelper) 
- 
Method SummaryModifier 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 booleanexists()intReturns the number of elements in this model builder.guiLight(BlockModel.GuiLight light) Set the parent model for the current model.renderType(String renderType) Set the render type for this model.renderType(ResourceLocation renderType) Set the render type for this model.private Tself()private NumberserializeFloat(float f) private StringserializeLocOrKey(String tex) private com.google.gson.JsonArrayserializeVector3f(org.joml.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.JsonObjecttoJson()Methods inherited from class net.minecraftforge.client.model.generators.ModelFileassertExistence, getLocation, getUncheckedLocation
- 
Field Details- 
parent
- 
textures
- 
transforms
- 
existingFileHelper
- 
renderType
- 
ambientOcclusionprotected boolean ambientOcclusion
- 
guiLight
- 
elements
- 
customLoader
- 
rootTransforms
 
- 
- 
Constructor Details- 
ModelBuilder
 
- 
- 
Method Details- 
self
- 
existsprotected boolean exists()
- 
parentSet the parent model for the current model.- Parameters:
- parent- the parent model
- Returns:
- this builder
- Throws:
- NullPointerException- if- parentis- null
- IllegalStateException- if- parentdoes not- exist
 
- 
textureSet the texture for a given dictionary key.- Parameters:
- key- the texture key
- texture- the texture, can be another key e.g.- "#all"
- Returns:
- this builder
- Throws:
- NullPointerException- if- keyis- null
- NullPointerException- if- textureis- null
- IllegalStateException- if- textureis not a key (does not start with- '#') and does not exist in any known resource pack
 
- 
textureSet the texture for a given dictionary key.- Parameters:
- key- the texture key
- texture- the texture
- Returns:
- this builder
- Throws:
- NullPointerException- if- keyis- null
- NullPointerException- if- textureis- null
- IllegalStateException- if- textureis not a key (does not start with- '#') and does not exist in any known resource pack
 
- 
renderTypeSet the render type for this model.- Parameters:
- renderType- the render type. Must be registered via- RegisterNamedRenderTypesEvent
- Returns:
- this builder
- Throws:
- NullPointerException- if- renderTypeis- null
 
- 
renderTypeSet the render type for this model.- Parameters:
- renderType- the render type. Must be registered via- RegisterNamedRenderTypesEvent
- Returns:
- this builder
- Throws:
- NullPointerException- if- renderTypeis- null
 
- 
transforms
- 
ao
- 
guiLight
- 
element
- 
elementGet 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
 
- 
getElementCountpublic int getElementCount()Returns the number of elements in this model builder.- Returns:
- the number of elements in this model builder
 
- 
customLoaderpublic <L extends CustomLoaderBuilder<T>> L customLoader(BiFunction<T, ExistingFileHelper, L> customLoaderFactory) Use a custom loader instead of the vanilla elements.- Parameters:
- customLoaderFactory- function that returns the custom loader to set, given this and the- existingFileHelper
- Returns:
- the custom loader builder
 
- 
rootTransforms
- 
toJson@VisibleForTesting public com.google.gson.JsonObject toJson()
- 
serializeLocOrKey
- 
serializeVector3fprivate com.google.gson.JsonArray serializeVector3f(org.joml.Vector3f vec) 
- 
serializeFloat
 
-