diff --git a/loader/src/main/java/net/neoforged/fml/config/ConfigTracker.java b/loader/src/main/java/net/neoforged/fml/config/ConfigTracker.java index 1f9cd639b..e293fc571 100644 --- a/loader/src/main/java/net/neoforged/fml/config/ConfigTracker.java +++ b/loader/src/main/java/net/neoforged/fml/config/ConfigTracker.java @@ -195,6 +195,7 @@ private void closeConfig(final ModConfig config) { LOGGER.trace(CONFIG, "Closing config file type {} at {} for {}", config.getType(), config.getFileName(), config.getModId()); unload(config); config.config = null; + config.getSpec().acceptConfig(null); config.postConfigEvent(ModConfigEvent.Unloading::new); } else { LOGGER.warn(CONFIG, "Closing non-file config {} at path {}", config.config, config.getFileName()); diff --git a/loader/src/main/java/net/neoforged/fml/config/IConfigSpec.java b/loader/src/main/java/net/neoforged/fml/config/IConfigSpec.java index 7cbc343db..f66e823c8 100644 --- a/loader/src/main/java/net/neoforged/fml/config/IConfigSpec.java +++ b/loader/src/main/java/net/neoforged/fml/config/IConfigSpec.java @@ -8,6 +8,7 @@ import com.electronwill.nightconfig.core.CommentedConfig; import com.electronwill.nightconfig.core.Config; import com.electronwill.nightconfig.core.UnmodifiableCommentedConfig; +import org.jetbrains.annotations.Nullable; /** * A config spec is responsible for interpreting (loading, correcting) raw {@link CommentedConfig}s from NightConfig. @@ -52,5 +53,5 @@ public interface IConfigSpec { * This is called on loading and on reloading. * The config is guaranteed to be valid according to {@link #isCorrect}. */ - void acceptConfig(CommentedConfig config); + void acceptConfig(@Nullable CommentedConfig config); }