T
- the type of the owning builder, which supplied the callback, and
will be returned upon completion.public static class ConfiguredModel.Builder<T>
extends java.lang.Object
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()
.
Modifier and Type | Field and Description |
---|---|
private java.util.function.Function<ConfiguredModel[],T> |
callback |
private ModelFile |
model |
private java.util.List<ConfiguredModel> |
otherModels |
private int |
rotationX |
private int |
rotationY |
private boolean |
uvLock |
private int |
weight |
Constructor and Description |
---|
Builder() |
Builder(java.util.function.Function<ConfiguredModel[],T> callback,
java.util.List<ConfiguredModel> otherModels) |
Modifier and Type | Method and Description |
---|---|
T |
addModel()
Apply the contained callback and return the owning builder object.
|
ConfiguredModel[] |
build()
Build all configured models and return them as an array.
|
ConfiguredModel |
buildLast()
Build the most recent model, as if
nextModel() was never called. |
ConfiguredModel.Builder<T> |
modelFile(ModelFile model)
Set the underlying model object for this configured model.
|
ConfiguredModel.Builder<T> |
nextModel()
Complete the current model and return a new builder instance with the same
callback, and storing all previously built models.
|
ConfiguredModel.Builder<T> |
rotationX(int value)
Set the x-rotation for this model.
|
ConfiguredModel.Builder<T> |
rotationY(int value)
Set the y-rotation for this model.
|
ConfiguredModel.Builder<T> |
uvLock(boolean value) |
ConfiguredModel.Builder<T> |
weight(int value)
Set the random weight for this model.
|
private ModelFile model
@Nullable private final java.util.function.Function<ConfiguredModel[],T> callback
private final java.util.List<ConfiguredModel> otherModels
private int rotationX
private int rotationY
private boolean uvLock
private int weight
Builder()
Builder(@Nullable java.util.function.Function<ConfiguredModel[],T> callback, java.util.List<ConfiguredModel> otherModels)
public ConfiguredModel.Builder<T> modelFile(ModelFile model)
model
- the modeljava.lang.NullPointerException
- if model
is null
public ConfiguredModel.Builder<T> rotationX(int value)
value
- the x-rotation valuejava.lang.IllegalArgumentException
- if value
is not a valid x-rotation
(see ModelRotation
)public ConfiguredModel.Builder<T> rotationY(int value)
value
- the y-rotation valuejava.lang.IllegalArgumentException
- if value
is not a valid y-rotation
(see ModelRotation
)public ConfiguredModel.Builder<T> uvLock(boolean value)
public ConfiguredModel.Builder<T> weight(int value)
value
- the weight valuejava.lang.IllegalArgumentException
- if value
is less than or equal to
zeropublic ConfiguredModel buildLast()
nextModel()
was never called.
Useful for single-model builders.public ConfiguredModel[] build()
public T addModel()
Known callbacks include:
java.lang.NullPointerException
- if there is no owning builder (and thus no callback)public ConfiguredModel.Builder<T> nextModel()