Class DexRotation

java.lang.Object
me.c7dev.dexterity.api.DexRotation

public class DexRotation extends Object
Manages all rotation events of a DexterityDisplay
  • Field Details

  • Constructor Details

    • DexRotation

      public DexRotation(DexterityDisplay d)
      Manages all rotations and data used for rotations for a specific DexterityDisplay
      Parameters:
      d -
    • DexRotation

      public DexRotation(DexterityDisplay d, Vector x, Vector y, Vector z)
      Manages all rotations and data used for rotations for a specific DexterityDisplay
      Parameters:
      d -
      x - The orthogonal unit vector for the selection's x direction
      y - The orthogonal unit vector for the selection's y direction
      z - The orthogonal unit vector for the selection's z direction
    • DexRotation

      public DexRotation(DexterityDisplay d, double yaw, double pitch, double roll)
      Manages all rotations and data used for rotations for a specific DexterityDisplay
      Parameters:
      d -
      yaw - The selection's yaw in degrees
      pitch - The selection's pitch in degrees
      roll - The selection's roll in degrees
  • Method Details

    • refreshAxis

      public void refreshAxis()
      Recalculate the axes of the selection based on the most common DexBlock rotation
    • getXAxis

      public Vector getXAxis()
    • getYAxis

      public Vector getYAxis()
    • getZAxis

      public Vector getZAxis()
    • setTransaction

      public void setTransaction(RotationTransaction t2)
      Set a transaction to be used to be able to undo a rotation
      Parameters:
      t2 -
    • clearCached

      public void clearCached()
      Clear the cached or pre-calculated data pertaining to the selection's rotations
    • getX

      public double getX()
    • getY

      public double getY()
    • getZ

      public double getZ()
    • getYaw

      public double getYaw()
    • getPitch

      public double getPitch()
    • getRoll

      public double getRoll()
    • setAxes

      public void setAxes(Vector x, Vector y, Vector z)
      Overwrite the axes of the selection, providing new orthogonal unit vectors
      Parameters:
      x -
      y -
      z -
    • setAxes

      public void setAxes(float yaw, float pitch, float roll)
      Recalculate the y, x, and z unit vectors by providing yaw, pitch, and roll in degrees
      Parameters:
      yaw -
      pitch -
      roll -
    • rotate

      public void rotate(float yaw_deg)
      Rotate around the yaw axis in degrees
      Parameters:
      yaw_deg -
    • rotate

      public org.joml.Quaterniond rotate(float yaw_deg, float pitch_deg, float roll_deg)
      Rotate around the yaw, pitch, and roll directions in degrees
    • rotate

      public org.joml.Quaterniond rotate(RotationPlan plan)
      Rotate by a specified plan with details about every axis and if it is asynchronous.
      Parameters:
      plan -
      Returns:
      Unmodifiable quaternion for the queued rotation
    • prepareRotation

      public QueuedRotation prepareRotation(RotationPlan plan, RotationTransaction transaction)
      Prepare a rotation that can be reused. Note that using this will not update the internal yaw, pitch, roll, x, y, or z, so refreshAxis() will be needed afterwards.
      Parameters:
      plan -
      transaction -
      Returns:
    • again

      public void again()
      Run the previous rotation again
    • rotate

      public void rotate(org.joml.Quaterniond q1)
      Queue a rotation
      Parameters:
      q1 -
    • rotate

      public void rotate(org.joml.Quaterniond q1, boolean async)
      Queue a rotation
      Parameters:
      q1 -
      async -
    • rotate

      public void rotate(QueuedRotation rotation)
      Queue a rotation
      Parameters:
      rotation -
    • clearQueue

      public void clearQueue()
      Clears the queue of scheduled rotations
    • getPreviousRotation

      public QueuedRotation getPreviousRotation()
      Get the data used for the previous rotation
      Returns:
      Unmodifiable object containing quaternion, transaction, and async boolean
    • highlightAxes

      public void highlightAxes(int seconds)
      Create marker points illustrating the direction of each axis. X: Red, Y: Lime, Z: Blue
      Parameters:
      seconds - The number of seconds that the marker points should last.