Class Vector3f

java.lang.Object
com.github.retrooper.packetevents.util.Vector3f

public class Vector3f extends Object
3D float Vector. This vector can represent coordinates, angles, or anything you want. You can use this to represent an array if you really want.
Since:
1.8
  • Field Details

    • x

      public final float x
      X (coordinate/angle/whatever you wish)
    • y

      public final float y
      Y (coordinate/angle/whatever you wish)
    • z

      public final float z
      Z (coordinate/angle/whatever you wish)
  • Constructor Details

    • Vector3f

      public Vector3f()
      Default constructor setting all coordinates/angles/values to their default values (=0).
    • Vector3f

      public Vector3f(float x, float y, float z)
      Constructor allowing you to set the values.
      Parameters:
      x - X
      y - Y
      z - Z
    • Vector3f

      public Vector3f(float[] array)
      Constructor allowing you to specify an array. X will be set to the first index of an array(if it exists, otherwise 0). Y will be set to the second index of an array(if it exists, otherwise 0). Z will be set to the third index of an array(if it exists, otherwise 0).
      Parameters:
      array - Array.
  • Method Details

    • getX

      public float getX()
    • getY

      public float getY()
    • getZ

      public float getZ()
    • equals

      public boolean equals(Object obj)
      Is the object we are comparing to equal to us? It must be of type Vector3d or Vector3i and all values must be equal to the values in this class.
      Overrides:
      equals in class Object
      Parameters:
      obj - Compared object.
      Returns:
      Are they equal?
    • hashCode

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

      public Vector3f add(float x, float y, float z)
    • add

      public Vector3f add(Vector3f other)
    • offset

      public Vector3f offset(BlockFace face)
    • subtract

      public Vector3f subtract(float x, float y, float z)
    • subtract

      public Vector3f subtract(Vector3f other)
    • multiply

      public Vector3f multiply(float x, float y, float z)
    • multiply

      public Vector3f multiply(Vector3f other)
    • multiply

      public Vector3f multiply(float value)
    • crossProduct

      public Vector3f crossProduct(Vector3f other)
    • dot

      public float dot(Vector3f other)
    • with

      public Vector3f with(Float x, Float y, Float z)
    • withX

      public Vector3f withX(float x)
    • withY

      public Vector3f withY(float y)
    • withZ

      public Vector3f withZ(float z)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • zero

      public static Vector3f zero()