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() {
|
public static void unloadChunks() {
|
||||||
//Down
|
|
||||||
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
|
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
|
||||||
|
//Down
|
||||||
ungenerateWorld(
|
ungenerateWorld(
|
||||||
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+i,
|
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+i,
|
||||||
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+3
|
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+3
|
||||||
);
|
);
|
||||||
}
|
//Up
|
||||||
//Up
|
|
||||||
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
|
|
||||||
ungenerateWorld(
|
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
|
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))-4
|
||||||
);
|
);
|
||||||
}
|
//Right
|
||||||
//Right
|
|
||||||
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
|
|
||||||
ungenerateWorld(
|
ungenerateWorld(
|
||||||
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)-4,
|
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)-4,
|
||||||
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i
|
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i
|
||||||
);
|
);
|
||||||
}
|
//Left
|
||||||
//Left
|
|
||||||
for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) {
|
|
||||||
ungenerateWorld(
|
ungenerateWorld(
|
||||||
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+3,
|
Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+3,
|
||||||
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i
|
(Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i
|
||||||
|
|||||||
Reference in New Issue
Block a user