mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +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
|
* @return the chunk X or Z based on the argument
|
||||||
*/
|
*/
|
||||||
public static int getChunkCoordinate(double xz) {
|
public static int getChunkCoordinate(double xz) {
|
||||||
assert Chunk.CHUNK_SIZE_X == Chunk.CHUNK_SIZE_Z;
|
// Assume chunk horizontal size being 16 (4 bits)
|
||||||
return Math.floorDiv((int) Math.floor(xz), Chunk.CHUNK_SIZE_X);
|
return (int) Math.floor(xz) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user