Record Class ChunkPos
java.lang.Object
java.lang.Record
net.minecraft.world.level.ChunkPos
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ChunkPos> private static final longprivate static final longprivate static final intprivate static final intprivate static final intstatic final longValue representing an absent or invalid chunkposstatic final intprivate static final intprivate static final intstatic final intstatic final intprivate static final intprivate static final intstatic final StreamCodec<io.netty.buffer.ByteBuf, ChunkPos> private final intThe field for thexrecord component.private final intThe field for thezrecord component.static final ChunkPos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ChunkPoscontaining(BlockPos pos) booleanprivate intdistanceSquared(int x, int z) intdistanceSquared(long pos) intdistanceSquared(ChunkPos pos) final booleanIndicates whether some other object is "equal to" this one.getBlockAt(int x, int y, int z) intgetBlockX(int offset) intgetBlockZ(int offset) intgetChessboardDistance(int x, int z) intintintgetMiddleBlockPosition(int y) intintintintintintintstatic intgetRegionX(long pos) intstatic intgetRegionZ(long pos) static intgetX(long pos) static intgetZ(long pos) static inthash(int x, int z) inthashCode()Returns a hash code value for this object.booleanisValid()static booleanisValid(int x, int z) static ChunkPosmaxFromRegion(int regionX, int regionZ) static ChunkPosminFromRegion(int regionX, int regionZ) longpack()static longpack(int x, int z) static longrangeClosed(ChunkPos center, int radius) rangeClosed(ChunkPos from, ChunkPos to) toString()Returns a string representation of this record class.static ChunkPosunpack(long key) intx()Returns the value of thexrecord component.intz()Returns the value of thezrecord component.
-
Field Details
-
x
private final int xThe field for thexrecord component. -
z
private final int zThe field for thezrecord component. -
CODEC
-
STREAM_CODEC
-
SAFETY_MARGIN
private static final int SAFETY_MARGIN- See Also:
-
INVALID_CHUNK_POS
public static final long INVALID_CHUNK_POSValue representing an absent or invalid chunkpos -
SAFETY_MARGIN_CHUNKS
private static final int SAFETY_MARGIN_CHUNKS -
MAX_COORDINATE_VALUE
public static final int MAX_COORDINATE_VALUE -
ZERO
-
COORD_BITS
private static final long COORD_BITS- See Also:
-
COORD_MASK
private static final long COORD_MASK- See Also:
-
REGION_BITS
private static final int REGION_BITS- See Also:
-
REGION_SIZE
public static final int REGION_SIZE- See Also:
-
REGION_MASK
private static final int REGION_MASK- See Also:
-
REGION_MAX_INDEX
public static final int REGION_MAX_INDEX- See Also:
-
HASH_A
private static final int HASH_A- See Also:
-
HASH_C
private static final int HASH_C- See Also:
-
HASH_Z_XOR
private static final int HASH_Z_XOR- See Also:
-
-
Constructor Details
-
ChunkPos
public ChunkPos(int x, int z) Creates an instance of aChunkPosrecord class.- Parameters:
x- the value for thexrecord componentz- the value for thezrecord component
-
-
Method Details
-
containing
-
unpack
-
minFromRegion
-
maxFromRegion
-
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) -
pack
-
getX
public static int getX(long pos) -
getZ
public static int getZ(long pos) -
hashCode
-
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
-
getBlockX
public int getBlockX(int offset) -
getBlockZ
public int getBlockZ(int offset) -
getMiddleBlockPosition
-
contains
-
toString
-
getWorldPosition
-
getChessboardDistance
-
getChessboardDistance
public int getChessboardDistance(int x, int z) -
distanceSquared
-
distanceSquared
public int distanceSquared(long pos) -
distanceSquared
private int distanceSquared(int x, int z) -
rangeClosed
-
rangeClosed
-
equals
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 thecomparemethod from their corresponding wrapper classes. -
x
public int x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
z
public int z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-