Class ScreenVector.Immutable

java.lang.Object
com.pixelmonmod.api.client.screen.util.ScreenVector
com.pixelmonmod.api.client.screen.util.ScreenVector.Immutable
All Implemented Interfaces:
net.minecraft.core.Position
Enclosing class:
ScreenVector

public static class ScreenVector.Immutable extends ScreenVector
Immutable version of ScreenVector. Any method which would mutate the vector now instead returns a new immutable vector containing the new values, leaving the old vector as-is.
  • Constructor Details

    • Immutable

      public Immutable(double x, double y)
      Constructs a new immutable vector with the given values, and the z value set to 0.
      Parameters:
      x - X value of the new vector.
      y - Y value of the new vector.
    • Immutable

      public Immutable(net.minecraft.core.Position position)
      Constructs a new immutable vector with values copied from an existing Position.
      Parameters:
      position - The Position to copy values from for the new vector.
    • Immutable

      public Immutable(double x, double y, double z)
      Constructs a new immutable vector with the given values.
      Parameters:
      x - X value of the new vector.
      y - Y value of the new vector.
      z - Z value of the new vector.
  • Method Details

    • zero

      public static ScreenVector.Immutable zero()
      Constructs a new zeroed immutable vector.
      Returns:
      A new zeroed immutable vector.
    • copy

      public ScreenVector copy()
      Copies the values of this vector into a new immutable vector.
      Overrides:
      copy in class ScreenVector
      Returns:
      A copy of this vector.
    • add

      public ScreenVector add(double x, double y, double z)
      Adds to the values of this vector. This will not mutate this vector, and will return a new vector containing the updated values.
      Overrides:
      add in class ScreenVector
      Parameters:
      x - The amount to add to the x value.
      y - The amount to add to the y value.
      z - The amount to add to the z value.
      Returns:
      The new vector.
    • mul

      public ScreenVector mul(double mx, double my, double mz)
      Multiplies the values of this vector by the given values. This will not mutate this vector, and will return a new vector containing the updated values.
      Overrides:
      mul in class ScreenVector
      Parameters:
      mx - The x value multiplier.
      my - The y value multiplier.
      mz - the z value multiplier.
      Returns:
      The new vector.
    • set

      public ScreenVector set(double x, double y, double z)
      Sets the values of this vector to the given values. This will not mutate this vector, and will return a new vector containing the updated values. As such, this is effectively a new vector constructor.
      Overrides:
      set in class ScreenVector
      Parameters:
      x - The new x value.
      y - The new y value.
      z - The new z value.
      Returns:
      The new vector.
    • normalize

      public ScreenVector normalize(Bounds bounds)
      Normalize this vector between 0 and 1 based on the given Bounds. This will not mutate this vector, and will return a new vector containing the updated values.
      Overrides:
      normalize in class ScreenVector
      Parameters:
      bounds - The bounds containing the min/max values to normalize on.
      Returns:
      The new vector.
    • toString

      public String toString()
      Overrides:
      toString in class ScreenVector