Skip to content

Commit

Permalink
Update config code
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Nov 25, 2024
1 parent 6e16b9b commit 079682b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions loader/src/main/java/net/neoforged/fml/loading/FMLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 079682b

Please sign in to comment.