fabric-loader icon indicating copy to clipboard operation
fabric-loader copied to clipboard

ModContainer#getRootPaths() doesn't seem to include classes build directory

Open mineLdiver opened this issue 1 year ago • 4 comments

Running FabricLoader.getInstance().getModContainer("modid").get().getRootPaths() on the workspace's mod only returns its resources build folder, not classes.

However, in a workspace with subprojects, the subprojects do get their classes included, but only because Gradle compiles them into a full jar, which Fabric Loader points at. Unlike Gradle though, IntelliJ uses folders for subprojects when running, and, again, only the resources folder gets included.

mineLdiver avatar Dec 28 '24 20:12 mineLdiver

Have you specifed the classpath groups? Loom has a DSL for this:

loom {
  mods {
    "modid" {
      sourceSet sourceSets.main
    }
  }
}

Mulit project builds should specify all of the mods here.

modmuss50 avatar Dec 28 '24 20:12 modmuss50

I don't think we did. Is there a way to automate this? The project has about as many modules as Fabric API, so I'd prefer to avoid having another list of modules explicitly written out like in settings.gradle.kts

mineLdiver avatar Dec 28 '24 20:12 mineLdiver

For context, this is the build.gradle.kts: https://github.com/ModificationStation/StationAPI/blob/develop/build.gradle.kts

mineLdiver avatar Dec 28 '24 20:12 mineLdiver

Realizing now that this is a huge case of an XY problem. Basically, I want to create a utility method which would return a modid based on the caller class. I thought it'd be as easy as iterating through all mods and doing .findPath() on each until the caller's path is found, but apparently not quite.

mineLdiver avatar Dec 29 '24 14:12 mineLdiver