Class ModelBuilder<T extends ModelBuilder<T>>
java.lang.Object
io.github.vampirestudios.vampirelib.client.model.ModelFile
io.github.vampirestudios.vampirelib.api.datagen.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 Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic enumclassNested classes/interfaces inherited from class io.github.vampirestudios.vampirelib.client.model.ModelFile
ModelFile.ExistingModelFile, ModelFile.UncheckedModelFile -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected CustomLoaderBuilderprotected final List<ModelBuilder<T>.ElementBuilder>protected final ExistingFileHelperprotected net.minecraft.client.renderer.block.model.BlockModel.GuiLightprotected @Nullable ModelFileprotected Stringprotected final ModelBuilder<T>.TransformsBuilder -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedModelBuilder(net.minecraft.resources.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 booleanexists()intReturns the number of elements in this model builder.guiLight(net.minecraft.client.renderer.block.model.BlockModel.GuiLight light) Set the parent model for the current model.renderType(String renderType) Set the render type for this model.renderType(net.minecraft.resources.ResourceLocation renderType) Set the render type for this model.Set the texture for a given dictionary key.Set the texture for a given dictionary key.com.google.gson.JsonObjecttoJson()Methods inherited from class io.github.vampirestudios.vampirelib.client.model.ModelFile
assertExistence, getLocation, getUncheckedLocation
-
Field Details
-
textures
-
transforms
-
existingFileHelper
-
elements
-
parent
-
renderType
-
ambientOcclusion
protected boolean ambientOcclusion -
guiLight
protected net.minecraft.client.renderer.block.model.BlockModel.GuiLight guiLight -
customLoader
-
-
Constructor Details
-
ModelBuilder
protected ModelBuilder(net.minecraft.resources.ResourceLocation outputLocation, ExistingFileHelper existingFileHelper)
-
-
Method Details
-
exists
protected boolean exists() -
parent
Set the parent model for the current model.- Parameters:
parent- the parent model- Returns:
- this builder
- Throws:
NullPointerException- ifparentisnullIllegalStateException- ifparentdoes 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- ifkeyisnullNullPointerException- iftextureisnullIllegalStateException- iftextureis 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- ifkeyisnullNullPointerException- iftextureisnullIllegalStateException- iftextureis not a key (does not start with'#') and does not exist in any known resource pack
-
renderType
Set the render type for this model.- Returns:
- this builder
- Throws:
NullPointerException- ifrenderTypeisnull
-
renderType
Set the render type for this model.- Returns:
- this builder
- Throws:
NullPointerException- ifrenderTypeisnull
-
transforms
-
ao
-
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()Returns 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- function that returns the custom loader to set, given this and theexistingFileHelper- Returns:
- the custom loader builder
-
toJson
public com.google.gson.JsonObject toJson()
-