Improve readabillity

This commit is contained in:
Lukas Rieger (Blue) 2024-05-15 00:45:34 +02:00
parent 2029fe0a87
commit b330c5d168
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6

View File

@ -269,8 +269,7 @@ public static MCAWorld load(Path worldFolder, Key dimension, DataPack dataPack)
// load level.dat // load level.dat
Path levelFile = worldFolder.resolve("level.dat"); Path levelFile = worldFolder.resolve("level.dat");
BlueNBT blueNBT = MCAUtil.addCommonNbtAdapters(new BlueNBT()); BlueNBT blueNBT = createBlueNBTForDataPack(dataPack);
blueNBT.register(TypeToken.get(DimensionType.class), new DimensionTypeDeserializer(blueNBT, dataPack));
LevelData levelData; LevelData levelData;
try (InputStream levelFileIn = Compression.GZIP.decompress(Files.newInputStream(levelFile))) { try (InputStream levelFileIn = Compression.GZIP.decompress(Files.newInputStream(levelFile))) {
levelData = blueNBT.read(levelFileIn, LevelData.class); levelData = blueNBT.read(levelFileIn, LevelData.class);
@ -297,4 +296,10 @@ public static Path resolveDimensionFolder(Path worldFolder, Key dimension) {
return worldFolder.resolve("dimensions").resolve(dimension.getNamespace()).resolve(dimension.getValue()); return worldFolder.resolve("dimensions").resolve(dimension.getNamespace()).resolve(dimension.getValue());
} }
private static BlueNBT createBlueNBTForDataPack(DataPack dataPack) {
BlueNBT blueNBT = MCAUtil.addCommonNbtAdapters(new BlueNBT());
blueNBT.register(TypeToken.get(DimensionType.class), new DimensionTypeDeserializer(blueNBT, dataPack));
return blueNBT;
}
} }