Forgix is a brand-new tool that allows Minecraft modders to combine multiple plugin/mod-loaders into one jar!
You don’t need to know much about Forgix as this is a tool for developers, but the mods you use may simply have a single file that you need to download, so you don’t have to worry about which mod-loader you’re installing for.
Yes, in its current state, it is quite ready for production usage and has worked on all mods I’ve tested and should work on your mod as well, even if your mod’s code base is very cursed. If anything breaks, simply open an issue on GitHub.
You could wait for update 2.0.0
which is a complete rewrite of the project but it releases anytime between now and [January 1, 4096 (UTC)]().
Forgix began as an experiment to see if I could merge multiple mod-loaders into one; I knew it was possible (despite the fact that a lot of people said it wasn’t), and after a lot of trial and error I managed to make a working prototype for semi-automatic jar merging, which was actually quite bad and was hard-coded to only work with the mod I was working on.
After realizing that it was doable, I rewrote the entire thing so that it could be used by the public, and so Forigx was born.
Forgix makes advantage of a JVM feature that only loads the classes that are called; by altering the packages slightly, we can make it such that each mod-loader calls its own package and does not interfere with other mod-loaders.
So, for example, Quilt goes into quilt.mod.json
and calls the entry-point from there, but we’ve updated the packages so that it only calls Quilt entry-points and not other mod-loader entry-points, and JVM will never load other classes since Quilt would never call them.
First apply the plugin in your root build.gradle
Then configure it to work with your mod! This process is going to be automatic in the future but I haven’t gotten time to make that yet.
Configuring the plugin to make it work
This is the normal configuration that by default should work on almost all mods.
forgix {
group = "org.example.mod"
mergedJarName = "example-mod"
}
The group
is the common package name for your mod and the mergedJarName
is going to be the name of the merged jar that it’s going to create, if the mergedJarName
doesn’t have an extension then it’s going to give it the extension jar
but keep in mind that sometimes the version number might be detected as an extension which at that point it won’t give it the extension jar
and you’ll have to manually do that.
Running the task mergeJars
(after running build
) would create the merged jars in the Merged
folder. (In the future this might be in the build/libs/merged
folder)
If you don’t want to run mergeJars
manually then you could add this. (In the future this might be the default behavior)
subprojects {
// ...
build.finalizedBy(mergeJars)
assemble.finalizedBy(mergeJars)
}
Documentation for each Forgix configuration!
Click to view
group
(String)
mergedJarName
(String)
jar
is added; however, it sometimes identifies the version number as an extension and does not add it; in that case, you need to manually add the jar
extension to the name.removeDuplicate
(String)
projectName
(String)
jarLocation
(String)
projectName
. By default, this retrieves the jar with the shortest name, which is quite scuffed but I don’t know how to retrieve the built jar without relying on loom or something similar, hopefully it’ll be better in the future though!additionalRelocate
(String, String)
group
s, which is useful for relocating libraries.mixin
(String)
projectName
(String)
jarLocation
(String)
projectName
. By default, this retrieves the jar with the shortest name, which is quite scuffed but I don’t know how to retrieve the built jar without relying on loom or something similar, hopefully it’ll be better in the future though!additionalRelocate
(String, String)
group
s, which is useful for relocating libraries.mixin
(String)
projectName
(String)
jarLocation
(String)
projectName
. By default, this retrieves the jar with the shortest name, which is quite scuffed but I don’t know how to retrieve the built jar without relying on loom or something similar, hopefully it’ll be better in the future though!additionalRelocate
(String, String)
group
s, which is useful for relocating libraries.projectName
(String)
jarLocation
(String)
projectName
. By default, this retrieves the jar with the shortest name, which is quite scuffed but I don’t know how to retrieve the built jar without relying on loom or something similar, hopefully it’ll be better in the future though!additionalRelocate
(String, String)
group
s, which is useful for relocating libraries.Because I’m not going to develop a new container for each mod-loader, this is the one that handles everything else. This can't handle Forge-like modloaders though due to Forge being weird and cursed. This configuration can be used more than once to specify multiple loaders.
projectName
(String)
jarLocation
(String)
projectName
. By default, this retrieves the jar with the shortest name, which is quite scuffed but I don’t know how to retrieve the built jar without relying on loom or something similar, hopefully it’ll be better in the future though!additionalRelocate
(String, String)
group
s, which is useful for relocating libraries.An example of a complete Forgix configuration:
forgix {
group = "org.example.mod" // (Required Value)
mergedJarName = "example-mod" // (Required Value)
outputDir = "build/libs/merged"
forge {
projectName = "forge"
jarLocation = "build/libs/example-mod.jar"
additionalRelocate "org.my.lib" "forge.org.my.lib"
additionalRelocate "org.my.lib.another" "forge.org.my.lib.another"
mixin "forge.mixins.json"
mixin "forge.mixins.another.json"
}
neoforge {
projectName = "neoforge"
jarLocation = "build/libs/example-mod.jar"
additionalRelocate "org.my.lib" "neoforge.org.my.lib"
additionalRelocate "org.my.lib.another" "neoforge.org.my.lib.another"
mixin "neoforge.mixins.json"
mixin "neoforge.mixins.another.json"
}
fabric {
projectName = "fabric"
jarLocation = "build/libs/example-mod.jar"
additionalRelocate "org.my.lib" "fabric.org.my.lib"
additionalRelocate "org.my.lib.another" "fabric.org.my.lib.another"
}
quilt {
projectName = "quilt"
jarLocation = "build/libs/example-mod.jar"
additionalRelocate "org.my.lib" "quilt.org.my.lib"
additionalRelocate "org.my.lib.another" "quilt.org.my.lib.another"
}
custom {
projectName = "sponge" // (Required Value)
jarLocation = "build/libs/example-mod.jar"
additionalRelocate "org.my.lib" "sponge.org.my.lib"
additionalRelocate "org.my.lib.another" "sponge.org.my.lib.another"
}
custom {
projectName = "spigot" // (Required Value)
jarLocation = "build/libs/example-mod.jar"
additionalRelocate "org.my.lib" "spigot.org.my.lib"
additionalRelocate "org.my.lib.another" "spigot.org.my.lib.another"
}
removeDuplicate "org.example.mod.core"
}
Depending on how far in the future you are, it very well could be. I am not going to update this every day; all future updates will be bug fixes for issues I haven’t found, quality of life improvements, or resolving that one Minecraft mod that won’t work due to how cursed its codebase is. If it works, it works