Record Class TrackerData

java.lang.Object
java.lang.Record
kr.toxicity.model.api.tracker.TrackerData
Record Components:
id - the model ID
scaler - the model scaler
rotator - the model rotator
modifier - the tracker modifier
bodyRotator - the body rotation data
hideOption - the entity hide options
markForSpawn - 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 Details

    • PARSER

      public static final com.google.gson.Gson PARSER
      The 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 a TrackerData record class.
      Parameters:
      id - the value for the id record component
      scaler - the value for the scaler record component
      rotator - the value for the rotator record component
      modifier - the value for the modifier record component
      bodyRotator - the value for the bodyRotator record component
      hideOption - the value for the hideOption record component
      markForSpawn - the value for the markForSpawn record component
  • Method Details

    • applyAs

      public void applyAs(@NotNull @NotNull EntityTracker tracker)
      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

      @NotNull public @NotNull ModelScaler scaler()
      Returns the model scaler, or a default entity scaler if not specified.
      Returns:
      the model scaler
      Since:
      1.15.2
    • rotator

      @NotNull public @NotNull ModelRotator rotator()
      Returns the model rotator, or a default YAW rotator if not specified.
      Returns:
      the model rotator
      Since:
      1.15.2
    • hideOption

      @NotNull public @NotNull EntityHideOption hideOption()
      Returns the entity hide option, or the default hide option if not specified.
      Returns:
      the entity hide option
      Since:
      1.15.2
    • markForSpawn

      @NotNull public @NotNull Set<UUID> 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

      @NotNull public EntityBodyRotator.RotatorData bodyRotator()
      Returns the body rotation data, or default body rotation data if not specified.
      Returns:
      the body rotation data
      Since:
      1.15.2
    • toString

      @NotNull public @NotNull String toString()
      Serializes this TrackerData object to a JSON string.
      Specified by:
      toString in class Record
      Returns:
      a JSON string representation of this object
      Since:
      1.15.2
    • 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.
    • id

      @NotNull public @NotNull String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • modifier

      @NotNull public @NotNull TrackerModifier modifier()
      Returns the value of the modifier record component.
      Returns:
      the value of the modifier record component