Class ChunkPosition

java.lang.Object
com.comphenix.protocol.wrappers.ChunkPosition

public class ChunkPosition extends Object
Copies a immutable net.minecraft.server.ChunkPosition, which represents a integer 3D vector.
Author:
Kristian
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Represents the null (0, 0, 0) origin.
    protected int
     
    protected int
     
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChunkPosition​(int x, int y, int z)
    Construct an immutable 3D vector.
    ChunkPosition​(org.bukkit.util.Vector vector)
    Construct an immutable integer 3D vector from a mutable Bukkit vector.
  • Method Summary

    Modifier and Type
    Method
    Description
    add​(ChunkPosition other)
    Adds the current position and a given position together, producing a result position.
    divide​(int divisor)
    Divide each dimension in the current position by the given divisor.
    boolean
    equals​(Object obj)
     
    Used to convert between NMS ChunkPosition and the wrapper instance.
    int
    Retrieve the x-coordinate.
    int
    Retrieve the y-coordinate.
    int
    Retrieve the z-coordinate.
    int
     
    multiply​(int factor)
    Multiply each dimension in the current position by the given factor.
    Adds the current position and a given position together, producing a result position.
     
    org.bukkit.util.Vector
    Convert this instance to an equivalent real 3D vector.

    Methods inherited from class java.lang.Object

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

    • ORIGIN

      public static ChunkPosition ORIGIN
      Represents the null (0, 0, 0) origin.
    • x

      protected final int x
    • y

      protected final int y
    • z

      protected final int z
  • Constructor Details

    • ChunkPosition

      public ChunkPosition(int x, int y, int z)
      Construct an immutable 3D vector.
      Parameters:
      x - - x coordinate
      y - - y coordinate
      z - - z coordinate
    • ChunkPosition

      public ChunkPosition(org.bukkit.util.Vector vector)
      Construct an immutable integer 3D vector from a mutable Bukkit vector.
      Parameters:
      vector - - the mutable real Bukkit vector to copy.
  • Method Details

    • toVector

      public org.bukkit.util.Vector toVector()
      Convert this instance to an equivalent real 3D vector.
      Returns:
      Real 3D vector.
    • getX

      public int getX()
      Retrieve the x-coordinate.
      Returns:
      X coordinate.
    • getY

      public int getY()
      Retrieve the y-coordinate.
      Returns:
      Y coordinate.
    • getZ

      public int getZ()
      Retrieve the z-coordinate.
      Returns:
      Z coordinate.
    • add

      public ChunkPosition add(ChunkPosition other)
      Adds the current position and a given position together, producing a result position.
      Parameters:
      other - - the other position.
      Returns:
      The new result position.
    • subtract

      public ChunkPosition subtract(ChunkPosition other)
      Adds the current position and a given position together, producing a result position.
      Parameters:
      other - - the other position.
      Returns:
      The new result position.
    • multiply

      public ChunkPosition multiply(int factor)
      Multiply each dimension in the current position by the given factor.
      Parameters:
      factor - - multiplier.
      Returns:
      The new result.
    • divide

      public ChunkPosition divide(int divisor)
      Divide each dimension in the current position by the given divisor.
      Parameters:
      divisor - - the divisor.
      Returns:
      The new result.
    • getConverter

      public static EquivalentConverter<ChunkPosition> getConverter()
      Used to convert between NMS ChunkPosition and the wrapper instance.
      Returns:
      A new converter.
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object