Record Class ModelData

java.lang.Object
java.lang.Record
kr.toxicity.model.api.data.raw.ModelData
Record Components:
meta - the metadata of the model
resolution - the texture resolution
elements - the list of cube/mesh elements
outliner - the hierarchical structure of the model
textures - the list of textures used in the model
animations - the list of animations
groups - the list of groups (used in BlockBench 5.0.0+)
placeholder - the animation variable placeholders

@Internal public record ModelData(@NotNull ModelMeta meta, @NotNull ModelResolution resolution, @NotNull List<ModelElement> elements, @NotNull List<ModelOutliner> outliner, @NotNull List<ModelTexture> textures, @Nullable List<ModelAnimation> animations, @Nullable List<ModelGroup> groups, @Nullable ModelPlaceholder placeholder) extends Record
Represents the raw data structure of a model file, typically parsed from a .bbmodel JSON file.

This record holds all the top-level components of a BlockBench model, including metadata, elements, textures, and animations. It serves as the initial data container before being processed into a ModelBlueprint.

Since:
1.15.2
  • Field Details

    • GSON

      public static final com.google.gson.Gson GSON
      The GSON parser configured for deserializing model data.
      Since:
      1.15.2
  • Constructor Details

  • Method Details

    • loadBlueprint

      @NotNull public @NotNull ModelLoadResult loadBlueprint(@NotNull @NotNull String name)
      Converts this raw model data into a processed ModelBlueprint.
      Parameters:
      name - the name to assign to the blueprint
      Returns:
      the result of the loading process, containing the blueprint and any errors
      Since:
      1.15.2
    • loadBlueprint

      @NotNull public @NotNull ModelLoadResult loadBlueprint(@NotNull @NotNull String name, boolean strict)
      Converts this raw model data into a processed ModelBlueprint with a specific loading mode.
      Parameters:
      name - the name to assign to the blueprint
      strict - whether to use strict loading mode (fail on unsupported features)
      Returns:
      the result of the loading process, containing the blueprint and any errors
      Since:
      1.15.2
    • assertSupported

      public void assertSupported()
      Asserts that the model does not contain any unsupported element types.
      Throws:
      RuntimeException - if an unsupported element is found
      Since:
      1.15.2
    • placeholder

      @NotNull public @NotNull ModelPlaceholder placeholder()
      Returns the animation variable placeholders, or an empty placeholder if none are defined.
      Returns:
      the animation variable placeholders
      Since:
      1.15.2
    • animations

      @NotNull public @NotNull List<ModelAnimation> animations()
      Returns the list of animations, or an empty list if none are defined.
      Returns:
      the list of animations
      Since:
      1.15.2
    • groups

      @NotNull public @NotNull List<ModelGroup> groups()
      Returns the list of groups, or an empty list if none are defined.
      Returns:
      the list of groups
      Since:
      1.15.2
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • meta

      @NotNull public @NotNull ModelMeta meta()
      Returns the value of the meta record component.
      Returns:
      the value of the meta record component
    • resolution

      @NotNull public @NotNull ModelResolution resolution()
      Returns the value of the resolution record component.
      Returns:
      the value of the resolution record component
    • elements

      @NotNull public @NotNull List<ModelElement> elements()
      Returns the value of the elements record component.
      Returns:
      the value of the elements record component
    • outliner

      @NotNull public @NotNull List<ModelOutliner> outliner()
      Returns the value of the outliner record component.
      Returns:
      the value of the outliner record component
    • textures

      @NotNull public @NotNull List<ModelTexture> textures()
      Returns the value of the textures record component.
      Returns:
      the value of the textures record component