Record Class BlockPos

java.lang.Object
java.lang.Record
com.zenith.mc.block.BlockPos
All Implemented Interfaces:
Comparable<BlockPos>

public record BlockPos(int x, int y, int z) extends Record implements Comparable<BlockPos>
  • Field Details

    • ZERO

      public static final BlockPos ZERO
    • PACKED_Y_LENGTH

      public static final int PACKED_Y_LENGTH
  • Constructor Details

    • BlockPos

      public BlockPos(double d, double e, double f)
    • BlockPos

      public BlockPos(BlockPos other)
    • BlockPos

      public BlockPos(int x, int y, int z)
      Creates an instance of a BlockPos record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
      z - the value for the z record component
  • Method Details

    • getChunkX

      public int getChunkX()
    • getChunkY

      public int getChunkY()
    • getChunkZ

      public int getChunkZ()
    • addX

      public BlockPos addX(int delta)
    • add

      public BlockPos add(int x, int y, int z)
    • addY

      public BlockPos addY(int delta)
    • addZ

      public BlockPos addZ(int delta)
    • minus

      public BlockPos minus(BlockPos other)
    • north

      public BlockPos north()
    • north

      public BlockPos north(int n)
    • south

      public BlockPos south()
    • south

      public BlockPos south(int n)
    • east

      public BlockPos east()
    • east

      public BlockPos east(int n)
    • west

      public BlockPos west()
    • west

      public BlockPos west(int n)
    • above

      public BlockPos above()
    • above

      public BlockPos above(int n)
    • below

      public BlockPos below()
    • below

      public BlockPos below(int n)
    • relative

      public BlockPos relative(Direction direction)
    • offset

      public BlockPos offset(BlockPos other)
    • subtract

      public BlockPos subtract(BlockPos other)
    • relative

      public BlockPos relative(Direction direction, int n)
    • distance

      public double distance(BlockPos other)
    • squaredDistance

      public double squaredDistance(BlockPos other)
    • squaredDistance

      public double squaredDistance(double x, double y, double z)
    • directionTo

      public org.cloudburstmc.math.vector.Vector3i directionTo(BlockPos other)
    • asLong

      public long asLong()
    • asLong

      public static long asLong(int x, int y, int z)
    • getX

      public static int getX(long packedPos)
    • getY

      public static int getY(long packedPos)
    • getZ

      public static int getZ(long packedPos)
    • compare

      public static int compare(int x1, int y1, int z1, int x2, int y2, int z2)
    • fromLong

      public static BlockPos fromLong(long l)
    • compareTo

      public int compareTo(@NonNull BlockPos o)
      Specified by:
      compareTo in interface Comparable<BlockPos>
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • longHash

      public static long longHash(BlockPos pos)
    • longHash

      public static long longHash(int x, int y, int z)
    • cross

      public BlockPos cross(BlockPos other)
    • offset

      public BlockPos offset(int x, int y, int z)
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • x

      public int x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public int y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • z

      public int z()
      Returns the value of the z record component.
      Returns:
      the value of the z record component