Merged all the for-loops for unloading together and fixed the problem with chunks not unloading when going up and to the right

This commit is contained in:
2020-04-09 11:41:28 -06:00
parent f95e9bdacc
commit 8311c80e44

View File

@@ -31,29 +31,23 @@ public class World {
}
public static void unloadChunks() {
//Down
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
//Down
ungenerateWorld(
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+i,
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+3
);
}
//Up
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
//Up
ungenerateWorld(
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+i,
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+i-1,
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))-4
);
}
//Right
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
//Right
ungenerateWorld(
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)-4,
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i
);
}
//Left
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
//Left
ungenerateWorld(
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+3,
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i