diff --git a/CubicChunksAPI/src/main/java/io/github/opencubicchunks/cubicchunks/api/world/storage/StorageFormatProviderBase.java b/CubicChunksAPI/src/main/java/io/github/opencubicchunks/cubicchunks/api/world/storage/StorageFormatProviderBase.java index 1dc13a105..a43d4273d 100644 --- a/CubicChunksAPI/src/main/java/io/github/opencubicchunks/cubicchunks/api/world/storage/StorageFormatProviderBase.java +++ b/CubicChunksAPI/src/main/java/io/github/opencubicchunks/cubicchunks/api/world/storage/StorageFormatProviderBase.java @@ -45,12 +45,13 @@ public static void init() { .create(); } - public static ResourceLocation defaultStorageFormatProviderName(ResourceLocation fallback) { + public static ResourceLocation defaultStorageFormatProviderName(String fallback) { ResourceLocation[] providersThatCanBeDefault = REGISTRY.getValuesCollection().stream() .filter(StorageFormatProviderBase::canBeDefault) .map(StorageFormatProviderBase::getRegistryName) .toArray(ResourceLocation[]::new); - return providersThatCanBeDefault.length == 1 ? providersThatCanBeDefault[0] : fallback; + return providersThatCanBeDefault.length == 1 ? providersThatCanBeDefault[0] : + fallback.isEmpty() ? DEFAULT : new ResourceLocation(fallback); } public ResourceLocation registryName; diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/core/world/WorldSavedCubicChunksData.java b/src/main/java/io/github/opencubicchunks/cubicchunks/core/world/WorldSavedCubicChunksData.java index 2e7c32873..fc8306afa 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/core/world/WorldSavedCubicChunksData.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/core/world/WorldSavedCubicChunksData.java @@ -49,7 +49,7 @@ public WorldSavedCubicChunksData(String name, boolean isCC, int minHeight, int m this.maxHeight = maxHeight; isCubicChunks = true; compatibilityGeneratorType = new ResourceLocation(CubicChunksConfig.compatibilityGeneratorType); - storageFormat = StorageFormatProviderBase.defaultStorageFormatProviderName(new ResourceLocation(CubicChunksConfig.storageFormat)); + storageFormat = StorageFormatProviderBase.defaultStorageFormatProviderName(CubicChunksConfig.storageFormat); } } @@ -65,7 +65,7 @@ public void readFromNBT(NBTTagCompound nbt) { if(nbt.hasKey("storageFormat")) storageFormat = new ResourceLocation(nbt.getString("storageFormat")); else - storageFormat = StorageFormatProviderBase.defaultStorageFormatProviderName(new ResourceLocation(CubicChunksConfig.storageFormat)); + storageFormat = StorageFormatProviderBase.defaultStorageFormatProviderName(CubicChunksConfig.storageFormat); } @Override