From ee384322d748e8938e4daabb901d5240c3e00acb Mon Sep 17 00:00:00 2001 From: "Blue (Lukas Rieger)" Date: Sat, 18 Jan 2020 12:47:06 +0100 Subject: [PATCH] Also search in parent folder for a level.dat --- .../java/de/bluecolored/bluemap/core/mca/MCAWorld.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/MCAWorld.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/MCAWorld.java index e020c3c3..2cbb696a 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/MCAWorld.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/MCAWorld.java @@ -357,7 +357,15 @@ private Path getMCAFilePath(Vector2i region) { public static MCAWorld load(Path worldFolder, UUID uuid, BlockIdMapper blockIdMapper, BlockPropertiesMapper blockPropertiesMapper, BiomeMapper biomeIdMapper) throws IOException { try { - CompoundTag level = (CompoundTag) NBTUtil.readTag(worldFolder.resolve("level.dat").toFile()); + File levelFile = new File(worldFolder.toFile(), "level.dat"); + if (!levelFile.exists()) { + levelFile = new File(worldFolder.toFile().getParentFile(), "level.dat"); + } + if (!levelFile.exists()) { + throw new FileNotFoundException("Could not find a level.dat file for this world!"); + } + + CompoundTag level = (CompoundTag) NBTUtil.readTag(levelFile); CompoundTag levelData = level.getCompoundTag("Data"); String name = levelData.getString("LevelName");