Fix an exception when trying to access ungenerated chunks in an area that has no region file

This commit is contained in:
Blue (Lukas Rieger) 2020-01-06 20:26:06 +01:00
parent 76ea6e1918
commit 7d9b4d3f4b
3 changed files with 5 additions and 2 deletions

View File

@ -223,7 +223,7 @@ public class BlueMapCLI {
File resourcePackFolder = configFolder.toPath().resolve("resourcepacks").toFile();
resourcePackFolder.mkdirs();
File[] resourcePacks = resourcePackFolder.listFiles();
Arrays.sort(resourcePacks);
Arrays.sort(resourcePacks); //load resource packs in alphabetical order so you can reorder them by renaming
List<File> resources = new ArrayList<>(resourcePacks.length + 1);
resources.add(defaultResourceFile);

View File

@ -28,6 +28,7 @@ import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.file.Path;
@ -225,6 +226,8 @@ public class MCAWorld implements World {
throw new IOException("invalid data tag: " + (tag == null ? "null" : tag.getClass().getName()));
}
} catch (FileNotFoundException ex) {
return Chunk.empty(this, chunkPos);
}
}

View File

@ -166,7 +166,7 @@ public class SpongePlugin {
File resourcePackFolder = getConfigPath().resolve("resourcepacks").toFile();
resourcePackFolder.mkdirs();
File[] resourcePacks = resourcePackFolder.listFiles();
Arrays.sort(resourcePacks);
Arrays.sort(resourcePacks); //load resource packs in alphabetical order so you can reorder them by renaming
List<File> resources = new ArrayList<>(resourcePacks.length + 1);
resources.add(defaultResourceFile);