mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-26 04:25:31 +01:00
Actually, we should not rely on an exception here
This commit is contained in:
parent
6e123e1c3f
commit
aaeeeb136a
@ -222,8 +222,11 @@ public Chunk getChunk(Vector2i chunkPos) throws IOException {
|
|||||||
private Chunk loadChunk(Vector2i chunkPos) throws IOException {
|
private Chunk loadChunk(Vector2i chunkPos) throws IOException {
|
||||||
Vector2i regionPos = chunkToRegion(chunkPos);
|
Vector2i regionPos = chunkToRegion(chunkPos);
|
||||||
Path regionPath = getMCAFilePath(regionPos);
|
Path regionPath = getMCAFilePath(regionPos);
|
||||||
|
|
||||||
try (RandomAccessFile raf = new RandomAccessFile(regionPath.toFile(), "r")) {
|
File regionFile = regionPath.toFile();
|
||||||
|
if (!regionFile.exists()) return Chunk.empty(this, chunkPos);
|
||||||
|
|
||||||
|
try (RandomAccessFile raf = new RandomAccessFile(regionFile, "r")) {
|
||||||
|
|
||||||
int xzChunk = Math.floorMod(chunkPos.getY(), 32) * 32 + Math.floorMod(chunkPos.getX(), 32);
|
int xzChunk = Math.floorMod(chunkPos.getY(), 32) * 32 + Math.floorMod(chunkPos.getX(), 32);
|
||||||
|
|
||||||
@ -253,8 +256,6 @@ private Chunk loadChunk(Vector2i chunkPos) throws IOException {
|
|||||||
} else {
|
} else {
|
||||||
throw new IOException("invalid data tag: " + (tag == null ? "null" : tag.getClass().getName()));
|
throw new IOException("invalid data tag: " + (tag == null ? "null" : tag.getClass().getName()));
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException ex) {
|
|
||||||
return Chunk.empty(this, chunkPos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user