Interface ModelRotator

All Superinterfaces:
BiFunction<Tracker, ModelRotation, ModelRotation>
All Known Implementing Classes:
ModelRotator.SourcedRotator

public sealed interface ModelRotator extends BiFunction<Tracker, ModelRotation, ModelRotation> permits ModelRotator.SourcedRotator (not exhaustive)
Defines how a model's rotation is calculated and applied.

Rotators can modify the base rotation (e.g., only applying yaw, smoothing rotation) and can be chained together.

Since:
1.15.2
  • Field Details

    • DESERIALIZER

      static final ModelRotator.Deserializer DESERIALIZER
      The global deserializer instance for rotators.
      Since:
      1.15.2
    • DEFAULT

      @NotNull static final @NotNull ModelRotator DEFAULT
      Default rotator (applies rotation as-is).
      Since:
      1.15.2
    • EMPTY

      @NotNull static final @NotNull ModelRotator EMPTY
      Empty rotator (returns zero rotation).
      Since:
      1.15.2
    • PITCH

      @NotNull static final @NotNull ModelRotator PITCH
      Pitch-only rotator.
      Since:
      1.15.2
    • YAW

      @NotNull static final @NotNull ModelRotator YAW
      Yaw-only rotator.
      Since:
      1.15.2
  • Method Details

    • deserialize

      @NotNull static @NotNull ModelRotator deserialize(@NotNull @NotNull com.google.gson.JsonObject object)
      Deserializes a rotator from a JSON object.
      Parameters:
      object - the JSON object
      Returns:
      the deserialized rotator, or EMPTY if invalid
      Since:
      1.15.2
    • lazy

      @NotNull static @NotNull ModelRotator lazy(long mills)
      Creates a lazy rotator that smooths rotation over time.
      Parameters:
      mills - the smoothing duration in milliseconds
      Returns:
      the lazy rotator
      Since:
      1.15.2
    • name

      @NotNull @NotNull String name()
      Returns the name of this rotator type.
      Returns:
      the name
      Since:
      1.15.2
    • source

      @Nullable @Nullable ModelRotator source()
      Returns the source rotator if this is a chained rotator.
      Returns:
      the source rotator, or null
      Since:
      1.15.2
    • data

      @Nullable @Nullable com.google.gson.JsonElement data()
      Returns the configuration data for this rotator.
      Returns:
      the data, or null
      Since:
      1.15.2
    • root

      @NotNull default @NotNull ModelRotator root()
      Returns the root rotator in the chain.
      Returns:
      the root rotator
      Since:
      1.15.2
    • serialize

      @NotNull default @NotNull com.google.gson.JsonObject serialize()
      Serializes this rotator to a JSON object.
      Returns:
      the JSON object
      Since:
      1.15.2
    • apply

      @NotNull default @NotNull ModelRotation apply(@NotNull @NotNull Tracker tracker)
      Applies the rotator to a tracker with default rotation.
      Parameters:
      tracker - the tracker
      Returns:
      the calculated rotation
      Since:
      1.15.2
    • apply

      @NotNull @NotNull ModelRotation apply(@NotNull @NotNull Tracker tracker, @NotNull @NotNull ModelRotation rotation)
      Applies the rotator to a tracker with a base rotation.
      Specified by:
      apply in interface BiFunction<Tracker, ModelRotation, ModelRotation>
      Parameters:
      tracker - the tracker
      rotation - the base rotation
      Returns:
      the calculated rotation
      Since:
      1.15.2
    • then

      @NotNull default @NotNull ModelRotator then(@NotNull @NotNull ModelRotator rotator)
      Chains this rotator with another one.
      Parameters:
      rotator - the next rotator in the chain
      Returns:
      the chained rotator
      Since:
      1.15.2