Record Class ChunkPos

java.lang.Object
java.lang.Record
net.minecraft.world.level.ChunkPos

public record ChunkPos(int x, int z) extends Record
  • Field Details

  • Constructor Details

    • ChunkPos

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

    • containing

      public static ChunkPos containing(BlockPos pos)
    • unpack

      public static ChunkPos unpack(long key)
    • minFromRegion

      public static ChunkPos minFromRegion(int regionX, int regionZ)
    • maxFromRegion

      public static ChunkPos maxFromRegion(int regionX, int regionZ)
    • isValid

      public boolean isValid()
    • isValid

      public static boolean isValid(int x, int z)
    • pack

      public long pack()
    • pack

      public static long pack(int x, int z)
    • fromSectionNode

      public static long fromSectionNode(long sectionNode)
    • pack

      public static long pack(BlockPos pos)
    • getX

      public static int getX(long pos)
    • getZ

      public static int getZ(long pos)
    • 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
    • hash

      public static int hash(int x, int z)
    • getMiddleBlockX

      public int getMiddleBlockX()
    • getMiddleBlockZ

      public int getMiddleBlockZ()
    • getMinBlockX

      public int getMinBlockX()
    • getMinBlockZ

      public int getMinBlockZ()
    • getMaxBlockX

      public int getMaxBlockX()
    • getMaxBlockZ

      public int getMaxBlockZ()
    • getRegionX

      public int getRegionX()
    • getRegionZ

      public int getRegionZ()
    • getRegionX

      public static int getRegionX(long pos)
    • getRegionZ

      public static int getRegionZ(long pos)
    • getRegionLocalX

      public int getRegionLocalX()
    • getRegionLocalZ

      public int getRegionLocalZ()
    • getBlockAt

      public BlockPos getBlockAt(int x, int y, int z)
    • getBlockX

      public int getBlockX(int offset)
    • getBlockZ

      public int getBlockZ(int offset)
    • getMiddleBlockPosition

      public BlockPos getMiddleBlockPosition(int y)
    • contains

      public boolean contains(BlockPos pos)
    • 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
    • getWorldPosition

      public BlockPos getWorldPosition()
    • getChessboardDistance

      public int getChessboardDistance(ChunkPos pos)
    • getChessboardDistance

      public int getChessboardDistance(int x, int z)
    • distanceSquared

      public int distanceSquared(ChunkPos pos)
    • distanceSquared

      public int distanceSquared(long pos)
    • distanceSquared

      private int distanceSquared(int x, int z)
    • rangeClosed

      public static Stream<ChunkPos> rangeClosed(ChunkPos center, int radius)
    • rangeClosed

      public static Stream<ChunkPos> rangeClosed(ChunkPos from, ChunkPos to)
    • 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
    • z

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