mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Inline ChunkUtils#retrieve to avoid computing chunk coordinate twice
This commit is contained in:
parent
a7b0b2685b
commit
2ad0263101
@ -90,7 +90,11 @@ public final class ChunkUtils {
|
||||
}
|
||||
|
||||
public static Chunk retrieve(Instance instance, Chunk originChunk, double x, double z) {
|
||||
return ChunkUtils.same(originChunk, x, z) ? originChunk : instance.getChunkAt(x, z);
|
||||
final int chunkX = getChunkCoordinate(x);
|
||||
final int chunkZ = getChunkCoordinate(z);
|
||||
final boolean sameChunk = originChunk.getChunkX() == chunkX &&
|
||||
originChunk.getChunkZ() == chunkZ;
|
||||
return sameChunk ? originChunk : instance.getChunk(chunkX, chunkZ);
|
||||
}
|
||||
|
||||
public static Chunk retrieve(Instance instance, Chunk originChunk, Point position) {
|
||||
|
Loading…
Reference in New Issue
Block a user