Ensure configuration backwards compatibility (resolve dimension from configured world if missing)
This commit is contained in:
parent
a98917a288
commit
2912252c89
|
@ -40,6 +40,7 @@ import de.bluecolored.bluemap.core.MinecraftVersion;
|
|||
import de.bluecolored.bluemap.core.debug.StateDumper;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.map.BmMap;
|
||||
import de.bluecolored.bluemap.core.resources.datapack.DataPack;
|
||||
import de.bluecolored.bluemap.core.resources.resourcepack.ResourcePack;
|
||||
import de.bluecolored.bluemap.core.storage.Storage;
|
||||
import de.bluecolored.bluemap.core.util.FileHelper;
|
||||
|
@ -188,6 +189,31 @@ public class BlueMapService implements Closeable {
|
|||
return;
|
||||
}
|
||||
|
||||
// if there is no dimension configured, we assume world-folder is actually the dimension-folder and convert (backwards compatibility)
|
||||
if (dimension == null) {
|
||||
worldFolder = worldFolder.normalize();
|
||||
if (worldFolder.endsWith("DIM-1")) {
|
||||
worldFolder = worldFolder.getParent();
|
||||
dimension = DataPack.DIMENSION_THE_NETHER;
|
||||
} else if (worldFolder.endsWith("DIM1")) {
|
||||
worldFolder = worldFolder.getParent();
|
||||
dimension = DataPack.DIMENSION_THE_END;
|
||||
} else if (
|
||||
worldFolder.getNameCount() > 3 &&
|
||||
worldFolder.getName(worldFolder.getNameCount() - 3).equals(Path.of("dimensions"))
|
||||
) {
|
||||
String namespace = worldFolder.getName(worldFolder.getNameCount() - 2).toString();
|
||||
String value = worldFolder.getName(worldFolder.getNameCount() - 1).toString();
|
||||
worldFolder = worldFolder.subpath(0, worldFolder.getNameCount() - 3);
|
||||
dimension = new Key(namespace, value);
|
||||
} else {
|
||||
dimension = DataPack.DIMENSION_OVERWORLD;
|
||||
}
|
||||
|
||||
Logger.global.logInfo("The map '" + name + "' has no dimension configured.\n" +
|
||||
"Assuming world: '" + worldFolder + "' and dimension: '" + dimension + "'.");
|
||||
}
|
||||
|
||||
if (!Files.isDirectory(worldFolder)) {
|
||||
throw new ConfigurationException(
|
||||
"'" + worldFolder.toAbsolutePath().normalize() + "' does not exist or is no directory!\n" +
|
||||
|
|
|
@ -69,7 +69,7 @@ public class HiresModelRenderer {
|
|||
for (z = min.getZ(); z <= max.getZ(); z++){
|
||||
|
||||
maxHeight = 0;
|
||||
topBlockLight = 0f;
|
||||
topBlockLight = 0;
|
||||
|
||||
columnColor.set(0, 0, 0, 0, true);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class LiquidModelBuilder {
|
|||
// filter out blocks that are in a "cave" that should not be rendered
|
||||
if (
|
||||
this.block.isRemoveIfCave() &&
|
||||
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0f
|
||||
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0
|
||||
) return;
|
||||
|
||||
int level = blockState.getLiquidLevel();
|
||||
|
|
|
@ -198,7 +198,7 @@ public class ResourceModelBuilder {
|
|||
// filter out faces that are in a "cave" that should not be rendered
|
||||
if (
|
||||
block.isRemoveIfCave() &&
|
||||
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0f
|
||||
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0
|
||||
) return;
|
||||
|
||||
// initialize the faces
|
||||
|
|
Loading…
Reference in New Issue