Class DexRotation

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

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

    Fields
    Modifier and Type
    Field
    Description
    static final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Manages all rotations and data used for rotations for a specific DexterityDisplay
    DexRotation(DexterityDisplay d, double yaw, double pitch, double roll)
    Manages all rotations and data used for rotations for a specific DexterityDisplay
    DexRotation(DexterityDisplay d, org.bukkit.util.Vector x, org.bukkit.util.Vector y, org.bukkit.util.Vector z)
    Manages all rotations and data used for rotations for a specific DexterityDisplay
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Run the previous rotation again
    void
    Clear the cached or pre-calculated data pertaining to the selection's rotations
    double
     
    Get the data used for the previous rotation
    double
     
    double
     
    org.bukkit.util.Vector
     
    double
     
    double
     
    org.bukkit.util.Vector
     
    double
     
    org.bukkit.util.Vector
     
    void
    highlightAxes(int seconds)
    Create marker points illustrating the direction of each axis.
    Prepare a rotation that can be reused.
    void
    Recalculate the axes of the selection based on the most common DexBlock rotation
    void
    rotate(float yaw_deg)
    Rotate around the yaw axis in degrees
    org.joml.Quaterniond
    rotate(float yaw_deg, float pitch_deg, float roll_deg)
    Rotate around the yaw, pitch, and roll directions in degrees
    void
    Queue a rotation
    org.joml.Quaterniond
    Rotate by a specified plan with details about every axis and if it is asynchronous.
    void
    rotate(org.joml.Quaterniond q1)
    Queue a rotation
    void
    rotate(org.joml.Quaterniond q1, boolean async)
    Queue a rotation
    void
    setAxes(float yaw, float pitch, float roll)
    Recalculate the y, x, and z unit vectors by providing yaw, pitch, and roll in degrees
    void
    setAxes(org.bukkit.util.Vector x, org.bukkit.util.Vector y, org.bukkit.util.Vector z)
    Overwrite the axes of the selection, providing new orthogonal unit vectors
    void
    Set a transaction to be used to be able to undo a rotation

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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, org.bukkit.util.Vector x, org.bukkit.util.Vector y, org.bukkit.util.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 org.bukkit.util.Vector getXAxis()
    • getYAxis

      public org.bukkit.util.Vector getYAxis()
    • getZAxis

      public org.bukkit.util.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(org.bukkit.util.Vector x, org.bukkit.util.Vector y, org.bukkit.util.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 -
    • 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.