Record Class ChunkPos
java.lang.Object
java.lang.Record
fr.fidorial.world.ChunkPos
- Record Components:
x- the chunk X coordinate, that is the block X coordinate shifted right by fourz- the chunk Z coordinate, that is the block Z coordinate shifted right by four
The coordinates of a 16x16 chunk column, independent of any world.
- Since:
- 0.1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longchunkKey(int chunkX, int chunkZ) Returns the coordinates packed into a singlelong, X in the high bits and Z in the low bits.static longReturns the position packed into a singlelong, X in the high bits and Z in the low bits.final booleanIndicates whether some other object is "equal to" this one.static ChunkPosfromBlock(int blockX, int blockZ) Returns the position of the chunk holding the given block coordinates.static ChunkPosfromKey(long key) Returns the position unpacked from alongbuilt bychunkKey(int, int).final inthashCode()Returns a hash code value for this object.longkey()Returns this position packed into a singlelong.final StringtoString()Returns a string representation of this record class.intx()Returns the value of thexrecord component.intz()Returns the value of thezrecord component.
-
Constructor Details
-
ChunkPos
-
-
Method Details
-
fromBlock
Returns the position of the chunk holding the given block coordinates.- Parameters:
blockX- the block X coordinateblockZ- the block Z coordinate- Returns:
- the position of the chunk holding the given block coordinates
- Since:
- 0.1.0
-
chunkKey
Returns the position packed into a singlelong, X in the high bits and Z in the low bits.- Parameters:
pos- the chunk position- Returns:
- the position packed into a single
long, X in the high bits and Z in the low bits - Since:
- 0.1.0
-
chunkKey
public static long chunkKey(int chunkX, int chunkZ) Returns the coordinates packed into a singlelong, X in the high bits and Z in the low bits.- Parameters:
chunkX- the chunk X coordinatechunkZ- the chunk Z coordinate- Returns:
- the coordinates packed into a single
long, X in the high bits and Z in the low bits - Since:
- 0.1.0
-
key
public long key()Returns this position packed into a singlelong.- Returns:
- this position packed into a single
long - Since:
- 0.1.0
- See Also:
-
fromKey
Returns the position unpacked from alongbuilt bychunkKey(int, int).- Parameters:
key- the packed position- Returns:
- the position unpacked from a
longbuilt bychunkKey(int, int) - Since:
- 0.1.0
-
toString
-
hashCode
-
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
-
z
-