y index utility method in ChunknQueueCoordinator

This commit is contained in:
dordsor21 2022-02-09 14:23:50 +00:00 committed by Jordan
parent fc93156362
commit c5ff743c9e

View File

@ -101,7 +101,7 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
}
private void storeCache(final int x, final int y, final int z, final @NonNull BlockState id) {
int yIndex = y - weWorld.getMinY();
int yIndex = getYIndex(y);
BlockState[][] resultY = result[yIndex];
if (resultY == null) {
result[yIndex] = resultY = new BlockState[length][];
@ -114,7 +114,7 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
}
private void storeCacheBiome(final int x, final int y, final int z, final @NonNull BiomeType id) {
int yIndex = y - weWorld.getMinY();
int yIndex = getYIndex(y);
BiomeType[][] resultY = biomeResult[yIndex];
if (resultY == null) {
biomeResult[yIndex] = resultY = new BiomeType[length][];
@ -134,7 +134,7 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
@Override
public @Nullable BlockState getBlock(int x, int y, int z) {
BlockState[][] blocksY = result[y - weWorld.getMinY()];
BlockState[][] blocksY = result[getYIndex(y)];
if (blocksY != null) {
BlockState[] blocksYZ = blocksY[z];
if (blocksYZ != null) {
@ -159,4 +159,8 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
return Location.at(getWorld().getName(), bot.getX(), bot.getY(), bot.getZ());
}
private int getYIndex(int y) {
return y - weWorld.getMinY();
}
}