diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/core/CubicChunksConfig.java b/src/main/java/io/github/opencubicchunks/cubicchunks/core/CubicChunksConfig.java index d2492c866..fbda581d1 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/core/CubicChunksConfig.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/core/CubicChunksConfig.java @@ -251,13 +251,21 @@ public static void sync() { private static void validateConfigValues() { if (!VanillaCompatibilityGeneratorProviderBase.REGISTRY.containsKey(new ResourceLocation(compatibilityGeneratorType))) { - CubicChunks.LOGGER.error("Compatibility generator type {} doesn't exist, resetting config to default", compatibilityGeneratorType); + CubicChunks.LOGGER.error("CubicChunksConfig: Compatibility generator type {} doesn't exist, resetting config to default", compatibilityGeneratorType); compatibilityGeneratorType = VanillaCompatibilityGeneratorProviderBase.DEFAULT.toString(); } if (!storageFormat.isEmpty() && !StorageFormatProviderBase.REGISTRY.containsKey(new ResourceLocation(storageFormat))) { - CubicChunks.LOGGER.error("Storage format {} doesn't exist, resetting config to default", storageFormat); + CubicChunks.LOGGER.error("CubicChunksConfig: Storage format {} doesn't exist, resetting config to default", storageFormat); storageFormat = ""; } + if ((defaultMinHeight & 0xF) != 0) { + CubicChunks.LOGGER.error("CubicChunksConfig: defaultMinHeight not a multiple of 16, got {}, setting to {}", defaultMinHeight, defaultMinHeight & ~0xF); + defaultMinHeight &= ~0xF; + } + if ((defaultMaxHeight & 0xF) != 0) { + CubicChunks.LOGGER.error("CubicChunksConfig: defaultMaxHeight not a multiple of 16, got {}, setting to {}", defaultMaxHeight, defaultMaxHeight & ~0xF); + defaultMaxHeight &= ~0xF; + } } private static void initDimensionRanges() { 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 35026bbde..aec44962e 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 @@ -55,8 +55,8 @@ public WorldSavedCubicChunksData(String name, boolean isCC, int minHeight, int m @Override public void readFromNBT(NBTTagCompound nbt) { - minHeight = nbt.getInteger("minHeight"); - maxHeight = nbt.getInteger("maxHeight"); + minHeight = nbt.getInteger("minHeight") & ~0xF; // set 4 least significant bits to zero to ensure they are always multiples of 16 + maxHeight = nbt.getInteger("maxHeight") & ~0xF; isCubicChunks = !nbt.hasKey("isCubicChunks") || nbt.getBoolean("isCubicChunks"); if(nbt.hasKey("compatibilityGeneratorType")) compatibilityGeneratorType = new ResourceLocation(nbt.getString("compatibilityGeneratorType"));