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

[1.3] Mod settings per run config #144

Closed
Juuxel opened this issue Jun 21, 2023 · 0 comments · Fixed by #145
Closed

[1.3] Mod settings per run config #144

Juuxel opened this issue Jun 21, 2023 · 0 comments · Fixed by #145
Labels
enhancement New feature or request

Comments

@Juuxel
Copy link
Member

Juuxel commented Jun 21, 2023

Why?

Mod settings (loom.mods) populates Forge's MOD_CLASSES env variable, which is used to determine which mods to load and from where. Crucially, Forge ignores everything else for local mods, and loads all mods defined in loom.mods.

This is problematic when you have a secondary mod, such as a test mod or a data generator, in another source set. Those mods should be compiled separately and aren't clearly needed when running the mod from the main source set - but they need their own mod settings, so FML would be loading/trying to load their classes. This can lead to crashes since the classes can be missing or outdated.

What?

I'm planning to add a local NamedDomainObjectContainer<ModSettings> to RunConfigSettings, which would override the global loom.mods container when not empty.

It might be easiest to only support this on Forge (and maybe call it forgeMods for that reason). Fabric/Quilt populate them in the DLI config, which is not currently specific to any run config:

if (!getExtension().getMods().isEmpty()) {
launchConfig.property("fabric.classPathGroups", getClassPathGroups());
}

Code example

loom {
  runs {
    data {
      // <data run config boilerplate>
      mods { // if non-empty, replaces the "global" mod settings container
        tinypotato {
          sourceSet sourceSets.main
          sourceSet sourceSets.data
        }
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant