Record Class ChunkLocation
java.lang.Object
java.lang.Record
dev.wyck.misc.ChunkLocation
- Record Components:
x- the chunk x coordinatez- the chunk z coordinate
A chunk location, represented as (x, z) chunk coordinates.
- Since:
- 0.0.6
-
Constructor Summary
ConstructorsConstructorDescriptionChunkLocation(int x, int z) Creates an instance of aChunkLocationrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncenterBlock(World world) Gets the center block of this chunk in the given world.booleanIndicates whether some other object is "equal to" this one.static ChunkLocationfromBlockCoords(int blockX, int blockZ) Creates a ChunkLocation from block coordinates.getCenterBiome(World world) Gets the biome of the center block of this chunk in the given world.inthashCode()Returns a hash code value for this object.booleanisChunk(int chunkX, int chunkZ) Checks if this ChunkLocation matches the given chunk coordinates.booleanDeprecated, for removal: This API element is subject to removal in a future version.Use isChunk(Chunk) or isChunk(int, int) instead.booleanChecks if this ChunkLocation matches the given Bukkit Chunk.booleanisWithinRadius(ChunkLocation other, int radius) Checks if this ChunkLocation is within a certain radius of another ChunkLocation.negate()Negates the chunk coordinates.static ChunkLocationof(int chunkX, int chunkZ) Creates a ChunkLocation from chunk coordinates.offset(int offsetX, int offsetZ) Offsets this ChunkLocation by the given x and z offsets.offset(ChunkLocation offset) Offsets this ChunkLocation by another ChunkLocation.toBukkitChunk(World world) Converts this ChunkLocation to a Bukkit Chunk in the given world.toString()Returns a string representation of this record class.intx()Returns the value of thexrecord component.intz()Returns the value of thezrecord component.
-
Constructor Details
-
ChunkLocation
-
-
Method Details
-
of
Creates a ChunkLocation from chunk coordinates.- Parameters:
chunkX- the chunk x coordinatechunkZ- the chunk z coordinate- Returns:
- a ChunkLocation representing the given chunk coordinates
-
fromBlockCoords
Creates a ChunkLocation from block coordinates.- Parameters:
blockX- the block x coordinateblockZ- the block z coordinate- Returns:
- a ChunkLocation representing the chunk containing the given block coordinates
-
isChunk
-
isChunk
Checks if this ChunkLocation matches the given chunk coordinates.- Parameters:
chunkX- the chunk x coordinate to comparechunkZ- the chunk z coordinate to compare- Returns:
- true if the coordinates match, false otherwise
-
isChunk
Deprecated, for removal: This API element is subject to removal in a future version.Use isChunk(Chunk) or isChunk(int, int) instead.- Throws:
UnsupportedOperationException- always
-
isWithinRadius
Checks if this ChunkLocation is within a certain radius of another ChunkLocation.- Parameters:
other- the other ChunkLocation to compareradius- the radius to check within- Returns:
- true if this ChunkLocation is within the radius of the other, false otherwise
-
offset
Offsets this ChunkLocation by the given x and z offsets.- Parameters:
offsetX- the x offsetoffsetZ- the z offset- Returns:
- a new ChunkLocation with the offset applied
-
offset
Offsets this ChunkLocation by another ChunkLocation.- Parameters:
offset- the ChunkLocation to offset by- Returns:
- a new ChunkLocation with the offset applied
-
negate
Negates the chunk coordinates.- Returns:
- a new ChunkLocation with negated x and z coordinates
-
toBukkitChunk
Converts this ChunkLocation to a Bukkit Chunk in the given world.- Parameters:
world- the world to get the chunk from- Returns:
- the Bukkit Chunk at this ChunkLocation in the given world
-
centerBlock
Gets the center block of this chunk in the given world.- Parameters:
world- the world to get the block from- Returns:
- the center block of this chunk in the given world
-
getCenterBiome
Gets the biome of the center block of this chunk in the given world.- Parameters:
world- the world to get the biome from- Returns:
- the biome of the center block of this chunk in the given world
-
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. -
hashCode
-
toString
-
x
-
z
-