Skip to content

Commit f89c32c

Browse files
committed
Build: Set FMLModType depending on which ModLauncher version is used
This attribute was previously set to `LIBRARY` before 0696479 where it was removed for the following reason: > however since we require shading and relocation on ML9 anyway, we may as well just remove it outright. This is fine for production, but relocation does not apply in development environments. The type should be declared as `GAMELIBRARY` on >=ML9, and `LIBRARY` on <=ML8. Anything which uses UniversalCraft should also be on the `GAME` layer, and cannot be on any other layer (e.g. PLUGIN) as it will not be able to access UniversalCraft classes. If we want other libraries to be usable in development environments (Vigilance, Elementa), we'll have to ship separate artifacts of those for >=ML9 and <=ML8 with the `FMLModType` attribute set accordingly.
1 parent ba14689 commit f89c32c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@ preprocess {
2929
vars.put("STANDALONE", 0)
3030
vars.put("!STANDALONE", 1)
3131
}
32+
33+
tasks.jar {
34+
if (platform.isModLauncher) {
35+
manifest {
36+
// `GAMELIBRARY` is required to access Minecraft classes from ModLauncher 9 and higher.
37+
val modType = if (platform.mcVersion >= 11700) "GAMELIBRARY" else "LIBRARY"
38+
attributes(mapOf("FMLModType" to modType))
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)