This commit is contained in:
mcrcortex
2025-04-18 08:08:51 +10:00
parent b0bd063ed6
commit 8ef53b3c4f

View File

@@ -205,9 +205,13 @@ public class WorldImporter implements IDataImporter {
var parts = entry.getName().split("/"); var parts = entry.getName().split("/");
var name = parts[parts.length-1]; var name = parts[parts.length-1];
var sections = name.split("\\."); var sections = name.split("\\.");
this.importRegion(buf, Integer.parseInt(sections[1]), Integer.parseInt(sections[2]));
buf.free();
try {
this.importRegion(buf, Integer.parseInt(sections[1]), Integer.parseInt(sections[2]));
} catch (NumberFormatException e) {
Logger.error("Invalid format for region position, x: \""+sections[1]+"\" z: \"" + sections[2] + "\" skipping region");
}
buf.free();
}); });
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -273,9 +277,15 @@ public class WorldImporter implements IDataImporter {
Logger.error("Unknown file: " + name); Logger.error("Unknown file: " + name);
throw new IllegalStateException(); throw new IllegalStateException();
} }
int rx = Integer.parseInt(sections[1]); int rx = 0;
int rz = Integer.parseInt(sections[2]); int rz = 0;
try {
rx = Integer.parseInt(sections[1]);
rz = Integer.parseInt(sections[2]);
} catch (NumberFormatException e) {
Logger.error("Invalid format for region position, x: \""+sections[1]+"\" z: \"" + sections[2] + "\" skipping region");
return;
}
try (var fileStream = FileChannel.open(file.toPath(), StandardOpenOption.READ)) { try (var fileStream = FileChannel.open(file.toPath(), StandardOpenOption.READ)) {
if (fileStream.size() == 0) { if (fileStream.size() == 0) {
return; return;