Class 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

    public static class ConfiguredModel.Builder<T>
    extends java.lang.Object
    A builder for ConfiguredModels, 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 Detail

      • callback

        @Nullable
        private final java.util.function.Function<ConfiguredModel[],​T> callback
      • rotationX

        private int rotationX
      • rotationY

        private int rotationY
      • uvLock

        private boolean uvLock
      • weight

        private int weight
    • Constructor Detail

      • Builder

        Builder()
    • Method Detail

      • modelFile

        public ConfiguredModel.Builder<T> modelFile​(ModelFile model)
        Set the underlying model object for this configured model.
        Parameters:
        model - the model
        Returns:
        this builder
        Throws:
        java.lang.NullPointerException - if model is null
      • rotationX

        public ConfiguredModel.Builder<T> rotationX​(int value)
        Set the x-rotation for this model.
        Parameters:
        value - the x-rotation value
        Returns:
        this builder
        Throws:
        java.lang.IllegalArgumentException - if value is not a valid x-rotation (see ModelRotation)
      • rotationY

        public ConfiguredModel.Builder<T> rotationY​(int value)
        Set the y-rotation for this model.
        Parameters:
        value - the y-rotation value
        Returns:
        this builder
        Throws:
        java.lang.IllegalArgumentException - if value is not a valid y-rotation (see ModelRotation)
      • weight

        public ConfiguredModel.Builder<T> weight​(int value)
        Set the random weight for this model.
        Parameters:
        value - the weight value
        Returns:
        this builder
        Throws:
        java.lang.IllegalArgumentException - if value is less than or equal to zero
      • buildLast

        public ConfiguredModel buildLast()
        Build the most recent model, as if nextModel() was never called. Useful for single-model builders.
        Returns:
        the most recently configured model
      • build

        public ConfiguredModel[] build()
        Build all configured models and return them as an array.
        Returns:
        the array of built models.
      • addModel

        public T 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:
        java.lang.NullPointerException - if there is no owning builder (and thus no callback)
      • nextModel

        public ConfiguredModel.Builder<T> 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