Silk Gradle Plugin is a tool designed to streamline the development of Fabric mods for the game Equilinox
- (Optional)
fabric.mod.jsonGeneration:- Generates the
fabric.mod.jsonfile based on a dedicated configuration block in yourbuild.gradle(.kts). - Optionally verifies the generated
fabric.mod.jsonagainst the schema.
- Generates the
- Subproject/Bundled Mod Support:
- Automatically includes JARs from specified subprojects (project dependencies) into your main mod's
META-INF/jars/directory. - Updates
fabric.mod.jsonto reference these bundled JARs, making multi-module mod development seamless.
- Automatically includes JARs from specified subprojects (project dependencies) into your main mod's
- Development Workflow:
runGame: Configures and launches Equilinox with your mod, its dependencies, and necessary JVM arguments for easy testing and debugging directly from Gradle.genSources: Generates a sources jar from the game jar which can be attached to IDEs for easier navigation of the source code.
- Java Development Kit (JDK): Version 17 or newer is required.
- Gradle
- Equilinox: You need a valid copy of the Equilinox game JAR.
-
Apply the Plugin: Add the Silk Gradle Plugin to your
build.gradle.kts(Kotlin DSL) orbuild.gradle(Groovy DSL).Kotlin DSL (
build.gradle.kts/settings.gradle.kts):plugins { id("de.rhm176.silk.silk-plugin") version "<version>" }pluginManagement { repositories { maven { url = uri("https://maven.rhm176.de/releases") name = "RHM's Maven" } gradlePluginPortal() } }Groovy DSL (
build.gradle/settings.gradle):plugins { id 'de.rhm176.silk.silk-plugin' version '<version>' }pluginManagement { repositories { maven { url = "https://maven.rhm176.de/releases" name = "RHM's Maven" } gradlePluginPortal() } }(Note: Replace
<version>with the version of the Silk Gradle Plugin you want to use. You can see all available versions on JitPack.)
Configure the plugin using the silk { ... } extension block in your Gradle build script.
-
Specifying the Equilinox Game JAR: The plugin requires the Equilinox game JAR. You provide this by adding it as a dependency to the
equilinoxconfiguration.Kotlin DSL (
build.gradle.kts) & Groovy DSL (build.gradle):dependencies { equilinox(files("path/to/your/EquilinoxGame.jar")) //or equilinox(silk.findEquilinoxGameJar()) } -
The
silkExtension Block:Kotlin DSL (
build.gradle.kts):silk { // Directory for the `runGame` task. Default: "project_dir/run" runDir.set(layout.projectDirectory.dir("run_equilinox")) // --- Fabric Mod Manifest (fabric.mod.json) --- // Set to true to generate fabric.mod.json from the `fabric` block below. // Default: false (expects a manual src/main/resources/fabric.mod.json). generateFabricModJson.set(true) // If true (default), validates the generated/manual fabric.mod.json against the schema. // verifyFabricModJson.set(true) // Configuration for the `fabric` manifest (used if generateFabricModJson is true) fabric { id.set("your_mod_id") version.set(project.version.toString()) // Or a fixed version string name.set("Your Awesome Mod") description.set("This mod makes Equilinox even more awesome.") authors.set(listOf("Your Name", "Another Author")) // contributors.set(listOf("Helpful Contributor")) contact.set(mapOf( "homepage" to "https://your.mod.homepage.com", "sources" to "https://github.com/yourusername/your-mod-repo", "issues" to "https://github.com/yourusername/your-mod-repo/issues" )) licenses.set(listOf("MIT")) // Or your preferred license ID (e.g., "ARR", "Apache-2.0") // iconFile.set("assets/your_mod_id/icon.png") // Path to your mod icon entrypoints { main.add("com.example.yourmod.YourModMainClass") } // List of your mixin configuration JSON files mixins.add("your_mod_id.mixins.json") // Dependencies on other mods or Fabric API depends.put("fabricloader", ">=0.15.0") // Recommended Fabric Loader version // depends.put("equilinox", ">=1.X.Y") // If you target a specific game version range recognized by Fabric // recommends.put("another_cool_mod", ">=1.2.0") // Path to your access widener file (e.g., "your_mod_id.accesswidener") // accessWidener.set("your_mod_id.accesswidener") // Custom values for fabric.mod.json // customData.put("myCustomKey", mapOf("some_data" to true, "value" to 42)) } // --- Vineflower Decompiler Settings (for genSources task) --- vineflower { version.set("1.9.3") // Specify the Vineflower version to use // args.set(listOf("--threads=4", "-Xmx1G")) // Optional: custom arguments for Vineflower } }Groovy DSL (
build.gradle):silk { runDir = layout.projectDirectory.dir("run_equilinox") generateFabricModJson = true // verifyFabricModJson = true fabric { id = "your_mod_id" version = project.version.toString() name = "Your Awesome Mod" description = "This mod makes Equilinox even more awesome." authors = ["Your Name", "Another Author"] // contributors = ["Helpful Contributor"] contact = [ homepage: "https://your.mod.homepage.com", sources: "https://github.com/yourusername/your-mod-repo", issues: "https://github.com/yourusername/your-mod-repo/issues" ] licenses = ["MIT"] // iconFile = "assets/your_mod_id/icon.png" entrypoints { main.add "com.example.yourmod.YourModMainClass" } mixins.add "your_mod_id.mixins.json" depends.put "fabricloader", ">=0.15.0" // depends.put "equilinox", ">=1.X.Y" // recommends.put "another_cool_mod", ">=1.2.0" // accessWidener = "your_mod_id.accesswidener" // customData.put "myCustomKey", [some_data: true, value: 42] } vineflower { version = "1.9.3" // args = ["--threads=4", "-Xmx1G"] } }Important Note on
generateFabricModJson:- If
generateFabricModJsonis set totrue, the plugin generatesfabric.mod.jsonintobuild/generated/silk/resources/main/fabric.mod.json. In this mode, you must not have a manualfabric.mod.jsonatsrc/main/resources/fabric.mod.json, as this will cause a build error. - If
generateFabricModJsonisfalse(the default), you are responsible for providing and maintainingsrc/main/resources/fabric.mod.jsonyourself. ThemodifyFabricModJsontask will still attempt to update this manual file if you bundle subprojects.
- If
-
Bundling Subprojects (Multi-project Builds): If your mod consists of multiple subprojects (modules) where some produce JARs that need to be included within your main mod JAR:
- Ensure the subprojects are standard Java projects that produce a JAR (e.g., apply the
javaorjava-libraryplugin to them). - Register these subprojects in your main mod project's
build.gradle(.kts)file using theregister()method within thesilk.modsblock.
The Silk plugin will then automatically include them in your main mod jar and add them to the
fabric.mod.json. Kotlin DSL (build.gradle.kts):silk { // ... other silk configurations ... mods { register(project(":submoduleA")) register(project(":submoduleB")) // Add more subprojects as needed } }Groovy DSL (
build.gradle):silk { // ... other silk configurations ... mods { register project(':submoduleA') register project(':submoduleB') // Add more subprojects as needed } } - Ensure the subprojects are standard Java projects that produce a JAR (e.g., apply the
The Silk Gradle Plugin configures and adds several useful tasks:
genSources(Group:Silk): Decompiles the transformed game JAR using Vineflower. Output is a sources JAR inbuild/silk/sources/.- Execute:
./gradlew genSources
- Execute:
runGame(Group:Silk): Launches Equilinox with your mod, its dependencies, and required natives and JVM arguments.- Working directory is configured by
silk.runDir. - Execute:
./gradlew runGame
- Working directory is configured by