Interface Interpolator<T>

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Interpolator<T>
Blends two values of type T by a normalized factor t in [0, 1]. Interpolators are pure functions; implementations should not mutate a or b.

Values that cannot be meaningfully blended (e.g. BlockData, ItemStack) should use a stepped interpolator (see Interpolators.stepped()) which returns a and reports isContinuous() as false.

  • Method Summary

    Modifier and Type
    Method
    Description
    interpolate(T a, T b, double t)
    Returns a value between a and b.
    default boolean
    Whether this interpolator produces meaningful intermediate values (true) or merely returns a until a discrete switch to b (false).
  • Method Details

    • interpolate

      @NotNull T interpolate(@NotNull T a, @NotNull T b, double t)
      Returns a value between a and b. Implementations may clamp t.
      Parameters:
      a - The non-null start value.
      b - The non-null end value.
      t - The normalized blend factor.
      Returns:
      The blended value.
    • isContinuous

      default boolean isContinuous()
      Whether this interpolator produces meaningful intermediate values (true) or merely returns a until a discrete switch to b (false). Used by playback helpers to choose between native interpolation and stepped scheduling.
      Returns:
      true if continuous.