Class ConfiguredModel.Builder<T>
java.lang.Object
net.minecraftforge.client.model.generators.ConfiguredModel.Builder<T>
- Type Parameters:
T
- the type of the owning builder, which supplied the callback, and will be returned upon completion.
- Enclosing class:
- ConfiguredModel
A builder for
ConfiguredModel
s, which can contain a callback for
processing the finished result. If no callback is available (e.g. in the case
of ConfiguredModel.builder()
), some methods will not be available.
Multiple models can be configured at once through the use of
nextModel()
.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Function<ConfiguredModel[],
T> private ModelFile
private final List<ConfiguredModel>
private int
private int
private boolean
private int
-
Constructor Summary
ConstructorDescriptionBuilder()
Builder
(Function<ConfiguredModel[], T> callback, List<ConfiguredModel> otherModels) -
Method Summary
Modifier and TypeMethodDescriptionaddModel()
Apply the contained callback and return the owning builder object.build()
Build all configured models and return them as an array.Build the most recent model, as ifnextModel()
was never called.Set the underlying model object for this configured model.Complete the current model and return a new builder instance with the same callback, and storing all previously built models.rotationX
(int value) Set the x-rotation for this model.rotationY
(int value) Set the y-rotation for this model.uvLock
(boolean value) weight
(int value) Set the random weight for this model.
-
Field Details
-
model
-
callback
-
otherModels
-
rotationX
private int rotationX -
rotationY
private int rotationY -
uvLock
private boolean uvLock -
weight
private int weight
-
-
Constructor Details
-
Builder
Builder() -
Builder
Builder(@Nullable Function<ConfiguredModel[], T> callback, List<ConfiguredModel> otherModels)
-
-
Method Details
-
modelFile
Set the underlying model object for this configured model.- Parameters:
model
- the model- Returns:
- this builder
- Throws:
NullPointerException
- ifmodel
isnull
-
rotationX
Set the x-rotation for this model.- Parameters:
value
- the x-rotation value- Returns:
- this builder
- Throws:
IllegalArgumentException
- ifvalue
is not a valid x-rotation (seeModelRotation
)
-
rotationY
Set the y-rotation for this model.- Parameters:
value
- the y-rotation value- Returns:
- this builder
- Throws:
IllegalArgumentException
- ifvalue
is not a valid y-rotation (seeModelRotation
)
-
uvLock
-
weight
Set the random weight for this model.- Parameters:
value
- the weight value- Returns:
- this builder
- Throws:
IllegalArgumentException
- ifvalue
is less than or equal to zero
-
buildLast
Build the most recent model, as ifnextModel()
was never called. Useful for single-model builders.- Returns:
- the most recently configured model
-
build
Build all configured models and return them as an array.- Returns:
- the array of built models.
-
addModel
Apply the contained callback and return the owning builder object. What the callback does is not defined by this class, but most likely it adds the built models to the current variant being configured.Known callbacks include:
- Returns:
- the owning builder object
- Throws:
NullPointerException
- if there is no owning builder (and thus no callback)
-
nextModel
Complete the current model and return a new builder instance with the same callback, and storing all previously built models.- Returns:
- a new builder for configuring the next model
-