diff --git a/loader/src/main/java/net/neoforged/fml/loading/FMLConfig.java b/loader/src/main/java/net/neoforged/fml/loading/FMLConfig.java index 60bd21a3b..6f40eb354 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/FMLConfig.java +++ b/loader/src/main/java/net/neoforged/fml/loading/FMLConfig.java @@ -114,8 +114,8 @@ private static Object maxThreads(final Object value) { } // Make sure that we don't end up "correcting" the config and removing dependency overrides - // Since we're not writing them by default, the default value can be null and we accept any objects (parsing and validation is done when the config is loaded) - configSpec.define("dependencyOverrides", Map::of, object -> true); + // We accept any objects (parsing and validation is done when the config is loaded) + configSpec.define("dependencyOverrides", () -> null, object -> true); configComments.set("dependencyOverrides", configComments.createSubConfig()); configComments.setComment("dependencyOverrides", """ Define dependency overrides below @@ -144,6 +144,10 @@ private void loadFrom(Path configFile) { } else { // This populates the config with the default values. configSpec.correct(this.configData); + + // Since dependency overrides have an empty validator, they need to be added manually. + // (Correct doesn't correct an absent value since it's valid). + this.configData.set("dependencyOverrides", this.configData.createSubConfig()); } this.configData.putAllComments(configComments);