Class Vector3i

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

public class Vector3i extends Object
3D int Vector. This vector can represent coordinates, angles, or anything you want. You can use this to represent an array if you really want. PacketEvents usually uses this for block positions as they don't need any decimals.
Since:
1.7
  • Field Details

    • x

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

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

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

    • Vector3i

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

      public Vector3i(long val)
    • Vector3i

      public Vector3i(long val, ServerVersion serverVersion)
    • Vector3i

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

      public Vector3i(int[] 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

    • getSerializedPosition

      public long getSerializedPosition(ServerVersion serverVersion)
    • getSerializedPosition

      public long getSerializedPosition()
    • getX

      public int getX()
    • getY

      public int getY()
    • getZ

      public int 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
    • toVector3d

      public Vector3d toVector3d()
    • add

      public Vector3i add(int x, int y, int z)
    • add

      public Vector3i add(Vector3i other)
    • offset

      public Vector3i offset(BlockFace face)
    • subtract

      public Vector3i subtract(int x, int y, int z)
    • subtract

      public Vector3i subtract(Vector3i other)
    • multiply

      public Vector3i multiply(int x, int y, int z)
    • multiply

      public Vector3i multiply(Vector3i other)
    • multiply

      public Vector3i multiply(int value)
    • crossProduct

      public Vector3i crossProduct(Vector3i other)
    • dot

      public int dot(Vector3i other)
    • with

      public Vector3i with(Integer x, Integer y, Integer z)
    • withX

      public Vector3i withX(int x)
    • withY

      public Vector3i withY(int y)
    • withZ

      public Vector3i withZ(int z)
    • toString

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

      public static Vector3i zero()