Home

Awesome

Forgix

Forgix is a brand-new tool that allows Minecraft modders to combine multiple plugin/mod-loaders into one jar!

How does this benefit me as a regular user?

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.

Is it stable enough for production use?

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).

How it all began

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.

How it works

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.

Usage and Documentation

First apply the plugin in your root build.gradle

<details closed> <summary>Applying the plugin</summary>

Groovy

Using plugins DSL:

<details closed> <summary>Click to view</summary>
plugins {
    id "io.github.pacifistmc.forgix" version "<version>"
}
</details>

Using the legacy plugin application:

<details closed> <summary>Click to view</summary>
buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "io.github.pacifistmc.forgix:Forgix:<version>"
    }
}

apply plugin: "io.github.pacifistmc.forgix"
</details>

Kotlin

Using plugins DSL:

<details closed> <summary>Click to view</summary>
plugins {
    id("io.github.pacifistmc.forgix") version "<version>"
}
</details>

Using the legacy plugin application:

<details closed> <summary>Click to view</summary>
buildscript {
    repositories {
        maven {
            url = uri("https://plugins.gradle.org/m2/")
        }
    }
    dependencies {
        classpath("io.github.pacifistmc.forgix:Forgix:<version>")
    }
}

apply(plugin = "io.github.pacifistmc.forgix")
</details>

Remember to change <version> with the latest version! You can get the latest version from Forgix Version.


</details>

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.

<details closed> <summary>Configuring the plugin to make it work</summary>

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)
}

</details>

Documentation for each Forgix configuration!

<details closed> <summary>Click to view</summary>

Root container (“forgix”)

Forge sub-container (“forge”)
NeoForge sub-container (“neoforge”)
Quilt sub-container (“quilt”)
Fabric sub-container (“fabric”)
Custom sub-container (“custom”)

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.

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"
}

</details>

This project feels dead

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