Package kr.toxicity.model.api.tracker
Record Class TrackerData
java.lang.Object
java.lang.Record
kr.toxicity.model.api.tracker.TrackerData
- Record Components:
id- the model IDscaler- the model scalerrotator- the model rotatormodifier- the tracker modifierbodyRotator- the body rotation datahideOption- the entity hide optionsmarkForSpawn- the set of player UUIDs marked for spawning
public record TrackerData(@NotNull String id, @Nullable ModelScaler scaler, @Nullable ModelRotator rotator, @NotNull TrackerModifier modifier, EntityBodyRotator.RotatorData bodyRotator, @Nullable EntityHideOption hideOption, @Nullable Set<UUID> markForSpawn)
extends Record
Represents the persistent data state of a tracker.
This record holds configuration and state information such as model ID, scaling, rotation, and visibility options, which can be serialized to JSON.
- Since:
- 1.15.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.gson.GsonThe GSON parser for serializing and deserializing tracker data. -
Constructor Summary
ConstructorsConstructorDescriptionTrackerData(@NotNull String id, @Nullable ModelScaler scaler, @Nullable ModelRotator rotator, @NotNull TrackerModifier modifier, EntityBodyRotator.RotatorData bodyRotator, @Nullable EntityHideOption hideOption, @Nullable Set<UUID> markForSpawn) Creates an instance of aTrackerDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyAs(@NotNull EntityTracker tracker) Applies this data to an existing entity tracker.Returns the body rotation data, or default body rotation data if not specified.static @NotNull TrackerDatadeserialize(@NotNull com.google.gson.JsonElement element) Deserializes tracker data from a JSON element.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull EntityHideOptionReturns the entity hide option, or the default hide option if not specified.@NotNull Stringid()Returns the value of theidrecord component.Returns the set of player UUIDs marked for spawning, or an empty set if not specified.@NotNull TrackerModifiermodifier()Returns the value of themodifierrecord component.@NotNull ModelRotatorrotator()Returns the model rotator, or a default YAW rotator if not specified.@NotNull ModelScalerscaler()Returns the model scaler, or a default entity scaler if not specified.@NotNull com.google.gson.JsonElementSerializes this data to a JSON element.@NotNull StringtoString()Serializes this TrackerData object to a JSON string.
-
Field Details
-
PARSER
public static final com.google.gson.Gson PARSERThe GSON parser for serializing and deserializing tracker data.- Since:
- 1.15.2
-
-
Constructor Details
-
TrackerData
public TrackerData(@NotNull @NotNull String id, @Nullable @Nullable ModelScaler scaler, @Nullable @Nullable ModelRotator rotator, @NotNull @NotNull TrackerModifier modifier, @Nullable EntityBodyRotator.RotatorData bodyRotator, @Nullable @Nullable EntityHideOption hideOption, @Nullable @Nullable Set<UUID> markForSpawn) Creates an instance of aTrackerDatarecord class.- Parameters:
id- the value for theidrecord componentscaler- the value for thescalerrecord componentrotator- the value for therotatorrecord componentmodifier- the value for themodifierrecord componentbodyRotator- the value for thebodyRotatorrecord componenthideOption- the value for thehideOptionrecord componentmarkForSpawn- the value for themarkForSpawnrecord component
-
-
Method Details
-
applyAs
Applies this data to an existing entity tracker.- Parameters:
tracker- the target tracker- Since:
- 1.15.2
-
serialize
@NotNull public @NotNull com.google.gson.JsonElement serialize()Serializes this data to a JSON element.- Returns:
- the JSON element
- Since:
- 1.15.2
-
deserialize
@NotNull public static @NotNull TrackerData deserialize(@NotNull @NotNull com.google.gson.JsonElement element) Deserializes tracker data from a JSON element.- Parameters:
element- the JSON element- Returns:
- the tracker data
- Since:
- 1.15.2
-
scaler
Returns the model scaler, or a default entity scaler if not specified.- Returns:
- the model scaler
- Since:
- 1.15.2
-
rotator
Returns the model rotator, or a default YAW rotator if not specified.- Returns:
- the model rotator
- Since:
- 1.15.2
-
hideOption
Returns the entity hide option, or the default hide option if not specified.- Returns:
- the entity hide option
- Since:
- 1.15.2
-
markForSpawn
Returns the set of player UUIDs marked for spawning, or an empty set if not specified.- Returns:
- the set of player UUIDs marked for spawning
- Since:
- 1.15.2
-
bodyRotator
Returns the body rotation data, or default body rotation data if not specified.- Returns:
- the body rotation data
- Since:
- 1.15.2
-
toString
Serializes this TrackerData object to a JSON string. -
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). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
modifier
Returns the value of themodifierrecord component.- Returns:
- the value of the
modifierrecord component
-