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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user