MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
526 stars 447 forks source link

[FG5] Mod dependencies won't load at runtime #814

Closed SuperMartijn642 closed 3 years ago

SuperMartijn642 commented 3 years ago

Versions:

Issue:

Any mods I add as dependencies using runtimeOnly or implementation in my buid.gradle won't load at runtime. Both using compileOnly and implementation, the dependencies are present for compilation. So far I've tried different FG versions, different Forge versions, invalidating caches in IntelliJ, regenerating run configurations, and adding the dependencies using a local flatDir repository.

I've also tried using Class.forName in my mod's constructor to see if classes from the dependencies were present. Sadly not, although that might be due to it being too early in the loading phase.

build.gradle file: https://gist.github.com/SuperMartijn642/40843d2e54dfc1dcde746315668056d6
Gradle import log: https://gist.github.com/SuperMartijn642/a865b7fe5be16b173f60ebc5ea5926ac
latest.log: https://gist.github.com/SuperMartijn642/a0ebc6e7b85c74d712d4becf9c279373
WithoutAName25 commented 3 years ago

I have the same issue. As solution until the bug is fixed I have declared the dependency only with compileOnly and added the mod file in /run/mods manually. If I do runtimeOnlyor implementation additionally, it didn't worked, so I think the classes of the dependency where loaded in runtime but not as mod.

SuperMartijn642 commented 3 years ago

That doesn't work because the mods in /run/mods don't get deobfuscated while the dev environment is deobfuscated.

SizableShrimp commented 3 years ago

This is not a ForgeGradle issue. Forge 1.17 is currently missing the ClasspathLocator class which was present in 1.16 which loaded mods off the classpath.