Forgix is a tool that allows Minecraft modders to combine multiple plugin/modloaders 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 modloader 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.
Forgix makes advantage of a JVM feature, the fact that it only loads the classes that are called; by altering the packages slightly, we can make it such that each modloader calls its own package and does not interfere with other modloaders.
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 modloader entry-points, and JVM will never load other classes since Quilt would never call them.
First apply the plugin in your root build.gradle
Applying the plugin
Using plugins DSL:
Click to view
plugins {
id "io.github.pacifistmc.forgix" version "<version>"
}
Using the legacy plugin application:
Click to view
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "io.github.pacifistmc.forgix:Forgix:<version>"
}
}
apply plugin: "io.github.pacifistmc.forgix"
Using plugins DSL:
Click to view
plugins {
id("io.github.pacifistmc.forgix") version "<version>"
}
Using the legacy plugin application:
Click to view
buildscript {
repositories {
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath("io.github.pacifistmc.forgix:Forgix:<version>")
}
}
apply(plugin = "io.github.pacifistmc.forgix")
Remember to change <version>
with the latest version! You can get the latest version from Forgix Version.
Now run mergeJars
and it should work!
Builds by default are generated in build/forgix
but can be altered.
OPTIONAL: Configuration
This is an example configuration to give a general idea.
forgix {
destinationDirectory = layout.projectDirectory.dir("build/forgix")
archiveClassifier = "merged"
archiveVersion = "1.0.0"
fabric()
neoforge { // How to set a custom input jar in case the automatic detection fails
inputJar = project(":neoforge").tasks.shadowJar.archiveFile
}
merge("nyaLoader") // How to add a custom modloader (note your project must be named "nyaLoader")
}
Documentation for each Forgix configuration
silence
(Boolean)- Whether to silence the thank you message.
- Defaults to
false
.
autoRun
(Boolean)- Whether to automatically run the
mergeJars
task. - Defaults to
false
.
- Whether to automatically run the
archiveClassifier
(String)- Sets the classifier for the merged archive.
- Defaults to a string joining all the platforms.
archiveVersion
(String)- Sets the version for the merged archive.
- Defaults to the root project's version.
destinationDirectory
(Directory)- Sets the directory where the merged jar will be placed.
- Defaults to
build/forgix
in the root project.
Forgix supports various modloaders and plugin platforms. For each one, you can either call the method with no arguments to use defaults, or provide a configuration block:
By default it should automatically detect and enable them accordingly.
forgix {
// Simple usage with defaults
fabric()
// With configuration
forge {
inputJar = project(":forge").tasks.shadowJar.archiveFile
}
}
Default platforms:
fabric()
- Fabric modloaderforge()
- Forge modloaderquilt()
- Quilt modloaderneoforge()
- NeoForge modloaderliteloader()
- LiteLoader modloaderrift()
- Rift modloaderplugin()
- General plugin projectbukkit()
- Bukkit pluginspigot()
- Spigot pluginpaper()
- Paper pluginsponge()
- Sponge pluginfoila()
- Foila pluginbungeecoord()
- BungeeCord pluginwaterfall()
- Waterfall pluginvelocity()
- Velocity plugin
Each loader configuration accepts the following options:
inputJar
(RegularFileProperty)- Sets the input jar file to be merged.
- If not specified, Forgix will attempt to automatically detect the jar file.
You can also use the generic merge()
method to specify any project:
forgix {
// Simple usage with defaults
merge("customLoader")
// With configuration
merge("customLoader") {
inputJar = project(":customLoader").tasks.shadowJar.archiveFile
}
}
An example of a complete Forgix configuration:
forgix {
silence = false
autoRun = false
archiveClassifier = "all-platforms"
archiveVersion = "1.0.0"
destinationDirectory = layout.projectDirectory.dir("build/forgix")
paper()
fabric()
forge {
inputJar = project(":forge").tasks.remapJar.archiveFile
}
merge("customLoader") {
inputJar = project(":customLoader").tasks.jar.archiveFile
}
}
If you donβt want to run mergeJars
manually then you can set this
This will automatically run mergeJars
at the end if you run the global assemble
or build
task.
forgix {
autoRun = true
}
Forgix is loader and minecraft independent, it is its own project and doesn't need much maintenance.
Depending on how far in the future you are, it very well could be dead. But the chances are that it'll still work!
Also you should checkout this very cool template generator!
Report any issues regarding the template generator here