Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add registerConfig method to ModContainer #99

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions loader/src/main/java/net/neoforged/fml/ModContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.neoforged.bus.api.Event;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.config.IConfigSpec;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.IModBusEvent;
import net.neoforged.fml.loading.progress.ProgressMeter;
Expand Down Expand Up @@ -155,6 +156,14 @@ public void addConfig(final ModConfig modConfig) {
configs.put(modConfig.getType(), modConfig);
}

public void registerConfig(ModConfig.Type type, IConfigSpec<?> configSpec) {
addConfig(new ModConfig(type, configSpec, this));
}

public void registerConfig(ModConfig.Type type, IConfigSpec<?> configSpec, String fileName) {
addConfig(new ModConfig(type, configSpec, this, fileName));
}

/**
* Does this mod match the supplied mod?
*
Expand Down
4 changes: 2 additions & 2 deletions loader/src/main/java/net/neoforged/fml/ModLoadingContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
return;
}

getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
getActiveContainer().registerConfig(type, spec);
}

public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
Expand All @@ -67,7 +67,7 @@ public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String file
return;
}

getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
getActiveContainer().registerConfig(type, spec, fileName);
}


Expand Down
Loading