Package kr.toxicity.model.api.data.raw
Record Class ModelDatapoint
java.lang.Object
java.lang.Record
kr.toxicity.model.api.data.raw.ModelDatapoint
- Record Components:
x- the x-coordinate value or scripty- the y-coordinate value or scriptz- the z-coordinate value or scriptscript- the script string (used for sound/particle effects)
@Internal
public record ModelDatapoint(@Nullable com.google.gson.JsonPrimitive x, @Nullable com.google.gson.JsonPrimitive y, @Nullable com.google.gson.JsonPrimitive z, @Nullable String script)
extends Record
Represents a single data point within a keyframe, which can be a static value or a Molang script.
This record holds the raw JSON values for x, y, and z coordinates, or a script string.
- Since:
- 1.15.2
-
Constructor Summary
ConstructorsConstructorDescriptionModelDatapoint(@Nullable com.google.gson.JsonPrimitive x, @Nullable com.google.gson.JsonPrimitive y, @Nullable com.google.gson.JsonPrimitive z, @Nullable String script) Creates an instance of aModelDatapointrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if this data point contains a script.@NotNull Stringscript()Returns the script string.@NotNull FloatFunction<org.joml.Vector3f> toFunction(@NotNull ModelLoadContext context) Converts this data point into a function that returns aVector3f.final StringtoString()Returns a string representation of this record class.@Nullable com.google.gson.JsonPrimitivex()Returns the value of thexrecord component.@Nullable com.google.gson.JsonPrimitivey()Returns the value of theyrecord component.@Nullable com.google.gson.JsonPrimitivez()Returns the value of thezrecord component.
-
Constructor Details
-
ModelDatapoint
public ModelDatapoint(@Nullable @Nullable com.google.gson.JsonPrimitive x, @Nullable @Nullable com.google.gson.JsonPrimitive y, @Nullable @Nullable com.google.gson.JsonPrimitive z, @Nullable @Nullable String script) Creates an instance of aModelDatapointrecord class.
-
-
Method Details
-
hasScript
public boolean hasScript()Checks if this data point contains a script.- Returns:
- true if a script is present, false otherwise
- Since:
- 1.15.2
-
script
Returns the script string.- Returns:
- the script
- Throws:
NullPointerException- if no script is present- Since:
- 1.15.2
-
toFunction
@NotNull public @NotNull FloatFunction<org.joml.Vector3f> toFunction(@NotNull @NotNull ModelLoadContext context) Converts this data point into a function that returns aVector3f.If the data point contains static values, it returns a constant function. If it contains Molang expressions, it compiles them into a function that evaluates the expressions.
- Parameters:
context- the model loading context- Returns:
- a function to get the vector value
- 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). -
x
@Nullable public @Nullable com.google.gson.JsonPrimitive x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
@Nullable public @Nullable com.google.gson.JsonPrimitive y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
@Nullable public @Nullable com.google.gson.JsonPrimitive z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-