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

public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile
General purpose model builder, contains all the commonalities between item and block models.
See Also:
  • Field Details

  • Constructor Details

    • ModelBuilder

      protected ModelBuilder(net.minecraft.resources.ResourceLocation outputLocation, ExistingFileHelper existingFileHelper)
  • Method Details

    • exists

      protected boolean exists()
      Specified by:
      exists in class ModelFile
    • parent

      public T parent(ModelFile parent)
      Set the parent model for the current model.
      Parameters:
      parent - the parent model
      Returns:
      this builder
      Throws:
      NullPointerException - if parent is null
      IllegalStateException - if parent does not exist
    • texture

      public T texture(String key, String texture)
      Set 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 key is null
      NullPointerException - if texture is null
      IllegalStateException - if texture is not a key (does not start with '#') and does not exist in any known resource pack
    • texture

      public T texture(String key, net.minecraft.resources.ResourceLocation texture)
      Set the texture for a given dictionary key.
      Parameters:
      key - the texture key
      texture - the texture
      Returns:
      this builder
      Throws:
      NullPointerException - if key is null
      NullPointerException - if texture is null
      IllegalStateException - if texture is not a key (does not start with '#') and does not exist in any known resource pack
    • renderType

      public T renderType(String renderType)
      Set the render type for this model.
      Returns:
      this builder
      Throws:
      NullPointerException - if renderType is null
    • renderType

      public T renderType(net.minecraft.resources.ResourceLocation renderType)
      Set the render type for this model.
      Returns:
      this builder
      Throws:
      NullPointerException - if renderType is null
    • transforms

      public ModelBuilder<T>.TransformsBuilder transforms()
    • ao

      public T ao(boolean ao)
    • guiLight

      public T guiLight(net.minecraft.client.renderer.block.model.BlockModel.GuiLight light)
    • element

      public ModelBuilder<T>.ElementBuilder element()
    • element

      public ModelBuilder<T>.ElementBuilder element(int index)
      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 the existingFileHelper
      Returns:
      the custom loader builder
    • toJson

      public com.google.gson.JsonObject toJson()