Package kr.toxicity.model.api.data.raw
Record Class ModelData
java.lang.Object
java.lang.Record
kr.toxicity.model.api.data.raw.ModelData
- Record Components:
meta- the metadata of the modelresolution- the texture resolutionelements- the list of cube/mesh elementsoutliner- the hierarchical structure of the modeltextures- the list of textures used in the modelanimations- the list of animationsgroups- 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.gson.GsonThe GSON parser configured for deserializing model data. -
Constructor Summary
ConstructorsConstructorDescriptionModelData(@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) Creates an instance of aModelDatarecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull List<ModelAnimation> Returns the list of animations, or an empty list if none are defined.voidAsserts that the model does not contain any unsupported element types.@NotNull List<ModelElement> elements()Returns the value of theelementsrecord component.final booleanIndicates whether some other object is "equal to" this one.@NotNull List<ModelGroup> groups()Returns the list of groups, or an empty list if none are defined.final inthashCode()Returns a hash code value for this object.@NotNull ModelLoadResultloadBlueprint(@NotNull String name) Converts this raw model data into a processedModelBlueprint.@NotNull ModelLoadResultloadBlueprint(@NotNull String name, boolean strict) Converts this raw model data into a processedModelBlueprintwith a specific loading mode.@NotNull ModelMetameta()Returns the value of themetarecord component.@NotNull List<ModelOutliner> outliner()Returns the value of theoutlinerrecord component.@NotNull ModelPlaceholderReturns the animation variable placeholders, or an empty placeholder if none are defined.@NotNull ModelResolutionReturns the value of theresolutionrecord component.@NotNull List<ModelTexture> textures()Returns the value of thetexturesrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
GSON
public static final com.google.gson.Gson GSONThe GSON parser configured for deserializing model data.- Since:
- 1.15.2
-
-
Constructor Details
-
ModelData
public ModelData(@NotNull @NotNull ModelMeta meta, @NotNull @NotNull ModelResolution resolution, @NotNull @NotNull List<ModelElement> elements, @NotNull @NotNull List<ModelOutliner> outliner, @NotNull @NotNull List<ModelTexture> textures, @Nullable @Nullable List<ModelAnimation> animations, @Nullable @Nullable List<ModelGroup> groups, @Nullable @Nullable ModelPlaceholder placeholder) Creates an instance of aModelDatarecord class.- Parameters:
meta- the value for themetarecord componentresolution- the value for theresolutionrecord componentelements- the value for theelementsrecord componentoutliner- the value for theoutlinerrecord componenttextures- the value for thetexturesrecord componentanimations- the value for theanimationsrecord componentgroups- the value for thegroupsrecord componentplaceholder- the value for theplaceholderrecord component
-
-
Method Details
-
loadBlueprint
Converts this raw model data into a processedModelBlueprint.- 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 processedModelBlueprintwith a specific loading mode.- Parameters:
name- the name to assign to the blueprintstrict- 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
Returns the animation variable placeholders, or an empty placeholder if none are defined.- Returns:
- the animation variable placeholders
- Since:
- 1.15.2
-
animations
Returns the list of animations, or an empty list if none are defined.- Returns:
- the list of animations
- Since:
- 1.15.2
-
groups
Returns the list of groups, or an empty list if none are defined.- Returns:
- the list of groups
- Since:
- 1.15.2
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
meta
Returns the value of themetarecord component.- Returns:
- the value of the
metarecord component
-
resolution
Returns the value of theresolutionrecord component.- Returns:
- the value of the
resolutionrecord component
-
elements
Returns the value of theelementsrecord component.- Returns:
- the value of the
elementsrecord component
-
outliner
Returns the value of theoutlinerrecord component.- Returns:
- the value of the
outlinerrecord component
-
textures
Returns the value of thetexturesrecord component.- Returns:
- the value of the
texturesrecord component
-