mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-30 21:17:53 +01:00
Make getChunkCoordinate
smarter and more efficient
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
6ab94bb778
commit
1c719a2fd7
@ -99,8 +99,8 @@ public final class ChunkUtils {
|
||||
* @return the chunk X or Z based on the argument
|
||||
*/
|
||||
public static int getChunkCoordinate(double xz) {
|
||||
assert Chunk.CHUNK_SIZE_X == Chunk.CHUNK_SIZE_Z;
|
||||
return Math.floorDiv((int) Math.floor(xz), Chunk.CHUNK_SIZE_X);
|
||||
// Assume chunk horizontal size being 16 (4 bits)
|
||||
return (int) Math.floor(xz) >> 4;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user