Class Rotation

java.lang.Object
dev.jorel.commandapi.wrappers.Rotation

public class Rotation extends Object
A class to represent the yaw and pitch rotation in degrees
  • Constructor Summary

    Constructors
    Constructor
    Description
    Rotation(float yaw, float pitch)
    Constructs a Rotation with a given yaw and pitch
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    float
    Normalizes the given pitch angle to a value between +/-90 degrees.
    float
    Normalizes the given yaw angle to a value between +/-180 degrees.
    float
    Gets the pitch of this rotation, measured in degrees.
    float
    Gets the yaw of this location, measured in degrees.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Rotation

      public Rotation(float yaw, float pitch)
      Constructs a Rotation with a given yaw and pitch
      Parameters:
      yaw - the yaw of this rotation in degrees
      pitch - the pitch of this rotation in degrees
  • Method Details

    • getYaw

      public float getYaw()
      Gets the yaw of this location, measured in degrees.
      Returns:
      this rotation's yaw
    • getPitch

      public float getPitch()
      Gets the pitch of this rotation, measured in degrees.
      Returns:
      this rotation's pitch
    • getNormalizedYaw

      public float getNormalizedYaw()
      Normalizes the given yaw angle to a value between +/-180 degrees.
      Returns:
      the normalized yaw in degrees
    • getNormalizedPitch

      public float getNormalizedPitch()
      Normalizes the given pitch angle to a value between +/-90 degrees.
      Returns:
      the normalized pitch in degrees
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the Minecraft string value of this Rotation, in the form "<yaw> <pitch>"
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object