### Forgix Gradle Plugin Configuration Source: https://context7.com/pacifistmc/forgix/llms.txt Configuration example for the Forgix Gradle plugin in a root build.gradle file, demonstrating multi-platform project setup. ```APIDOC ## Complete Multi-Platform Project Example ### Description A comprehensive example showing a full multi-platform Minecraft mod project structure with Forgix configuration for both loader merging and multiversion support. ### Method Apply the `io.github.pacifistmc.forgix` plugin in your root `build.gradle` file and configure the `forgix` block. ### Endpoint N/A (Gradle Plugin Configuration) ### Parameters #### Query Parameters N/A #### Request Body ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } // Shared configuration for all subprojects subprojects { apply plugin: 'java' group = 'com.example' version = '1.0.0' java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } } forgix { silence = false autoRun = true archiveBaseName = rootProject.name archiveClassifier = "universal" archiveVersion = project.version destinationDirectory = layout.projectDirectory.dir("build/release") // Mod loaders fabric() forge { inputJar = project(":forge").tasks.shadowJar.archiveFile } neoforge() quilt() // Server plugins paper() velocity() } ``` ### Request Example ```groovy // Example project structure: // my-awesome-mod/ // ├── common/ <- Shared code (optional) // │ └── build.gradle // ├── fabric/ // │ ├── src/main/java/ // │ ├── src/main/resources/fabric.mod.json // │ └── build.gradle // ├── forge/ // │ ├── src/main/java/ // │ ├── src/main/resources/META-INF/mods.toml // │ └── build.gradle // ├── neoforge/ // │ ├── src/main/java/ // │ ├── src/main/resources/META-INF/neoforge.mods.toml // │ └── build.gradle // ├── quilt/ // │ ├── src/main/java/ // │ ├── src/main/resources/quilt.mod.json // │ └── build.gradle // ├── paper/ // │ ├── src/main/java/ // │ ├── src/main/resources/plugin.yml // │ └── build.gradle // ├── velocity/ // │ ├── src/main/java/ // │ └── build.gradle // ├── settings.gradle // └── build.gradle <- This file // Build command: // ./gradlew build // // Output: build/release/my-awesome-mod-universal-1.0.0.jar // This single JAR works on Fabric, Forge, NeoForge, Quilt, Paper, and Velocity! ``` ### Response #### Success Response (200) - **outputFile** (File) - The generated universal JAR file, located in the `destinationDirectory`. #### Response Example ``` build/release/my-awesome-mod-universal-1.0.0.jar ``` ### Notes - The plugin auto-detects subprojects named after supported loaders. - Custom configurations allow specifying any project or JAR file. - `autoRun = true` ensures the merged JAR is produced automatically after builds. ``` -------------------------------- ### Forgix Gradle Configuration Example Source: https://github.com/pacifistmc/forgix/blob/main/README.md An example of configuring the Forgix plugin in a Gradle build script. It demonstrates setting the destination directory, archive classifier, and version, as well as configuring specific modloaders like Fabric and NeoForge. ```groovy 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") } ``` -------------------------------- ### Complete Forgix Configuration Example Source: https://github.com/pacifistmc/forgix/blob/main/README.md An example of a comprehensive Forgix configuration, including global settings like `silence`, `autoRun`, `archiveClassifier`, `archiveVersion`, `destinationDirectory`, and configurations for multiple platforms and custom loaders. ```groovy 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 } } ``` -------------------------------- ### Basic Forgix Configuration with Auto-Detection (Groovy) Source: https://context7.com/pacifistmc/forgix/llms.txt Shows a basic Forgix setup where the plugin automatically detects subprojects named after supported modloaders. The `mergeJars` task is then used to create the unified JAR. ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } // Project structure (auto-detected): // my-mod/ // ├─ fabric/ <- Automatically detected as Fabric loader // │ ├─ build.gradle // ├─ forge/ <- Automatically detected as Forge loader // │ ├─ build.gradle // └─ build.gradle <- Root with Forgix plugin // Build and merge: // ./gradlew build mergeJars // Output: build/forgix/my-mod-fabric-forge-.jar ``` -------------------------------- ### Merge Modloader JARs Programmatically with Forgix Java API Source: https://context7.com/pacifistmc/forgix/llms.txt Provides a Java code example using the `Forgix.mergeLoaders()` method to programmatically merge multiple modloader JARs. It shows how to map JAR files to loader names and specify the output file. ```java import io.github.pacifistmc.forgix.Forgix; import java.io.File; import java.util.HashMap; import java.util.Map; public class MergeExample { public static void main(String[] args) { // Map JAR files to their loader names Map jarsAndLoadersMap = new HashMap<>(); jarsAndLoadersMap.put(new File("mymod-forge.jar"), "forge"); jarsAndLoadersMap.put(new File("mymod-fabric.jar"), "fabric"); jarsAndLoadersMap.put(new File("mymod-neoforge.jar"), "neoforge"); // Output file for the merged JAR File outputFile = new File("build/merged/mymod-universal.jar"); // Merge with console output Forgix.mergeLoaders(jarsAndLoadersMap, outputFile); // Output: // Thank you for using Forgix! // Forgix: 2.0.0-SNAPSHOT.5.1 // Please report any issues to https://github.com/PacifistMC/Forgix/issues // Merge silently (no console output) Forgix.mergeLoaders(jarsAndLoadersMap, outputFile, true); } } ``` -------------------------------- ### Apply Forgix Plugin (Groovy DSL) Source: https://context7.com/pacifistmc/forgix/llms.txt Demonstrates how to apply the Forgix Gradle plugin in a Groovy DSL build script. It shows both the recommended plugins DSL and the legacy buildscript approach. ```groovy // root build.gradle - Using plugins DSL (recommended) plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } // Alternative: Using legacy plugin application buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "io.github.pacifistmc.forgix:Forgix:2.0.0-SNAPSHOT.5.1" } } apply plugin: "io.github.pacifistmc.forgix" ``` -------------------------------- ### Use Forgix CLI to Merge Multiversion JARs Source: https://context7.com/pacifistmc/forgix/llms.txt Demonstrates using the Forgix command-line interface to merge JAR files built for different Minecraft versions into a single output JAR. The JARs are listed directly after the command. ```bash # Merge multiple Minecraft version JARs into one java -jar forgix.jar mergeVersions \ --output path/to/multiversion.jar \ mymod-1.18.2.jar \ mymod-1.19.4.jar \ mymod-1.20.1.jar \ mymod-1.21.1.jar # Example output: # Thank you for using Forgix! # Forgix: 2.0.0-SNAPSHOT.5.1 # Please report any issues to https://github.com/PacifistMC/Forgix/issues # Successfully merged jars into /path/to/merged.jar ``` -------------------------------- ### Custom Input JAR Configuration with Forgix (Groovy) Source: https://context7.com/pacifistmc/forgix/llms.txt Explains how to configure custom input JARs for specific loaders when automatic detection is insufficient, such as when using tasks like `shadowJar` or `remapJar` from other plugins. ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } forgix { archiveClassifier = "merged" archiveVersion = project.version // Use default detection for fabric fabric() // Specify custom input jar for forge (e.g., after shadow/remapping) forge { inputJar = project(":forge").tasks.shadowJar.archiveFile } // Specify custom input jar for neoforge neoforge { inputJar = project(":neoforge").tasks.remapJar.archiveFile } } // Build sequence: // ./gradlew :fabric:build :forge:shadowJar :neoforge:remapJar mergeJars ``` -------------------------------- ### Full Forgix Configuration Options (Groovy) Source: https://context7.com/pacifistmc/forgix/llms.txt Details the extensive configuration options available through the `forgix` extension, including silencing messages, controlling auto-run behavior, setting archive classifiers and versions, specifying output directories, and enabling specific loaders. ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } forgix { // Suppress the "Thank you for using Forgix!" message silence = false // Automatically run mergeJars after the root project's jar task autoRun = false // Set the classifier for the merged archive (appears before version) archiveClassifier = "all-platforms" // Set the version for the merged archive archiveVersion = "1.0.0" // Set the output directory for the merged jar destinationDirectory = layout.projectDirectory.dir("build/forgix") // Enable loaders with default detection fabric() forge() quilt() neoforge() // Server plugin platforms paper() bukkit() spigot() velocity() bungeecord() waterfall() sponge() } // Output: build/forgix/my-mod-all-platforms-1.0.0.jar ``` -------------------------------- ### Apply Forgix Plugin (Kotlin DSL) Source: https://context7.com/pacifistmc/forgix/llms.txt Illustrates how to apply the Forgix Gradle plugin in a Kotlin DSL build script. This covers the plugins DSL and the legacy buildscript methods. ```kotlin // root build.gradle.kts - Using plugins DSL (recommended) plugins { id("io.github.pacifistmc.forgix") version "2.0.0-SNAPSHOT.5.1" } // Alternative: Using legacy plugin application buildscript { repositories { maven { url = uri("https://plugins.gradle.org/m2/") } } dependencies { classpath("io.github.pacifistmc.forgix:Forgix:2.0.0-SNAPSHOT.5.1") } } apply(plugin = "io.github.pacifistmc.forgix") ``` -------------------------------- ### Use Forgix CLI to Merge Modloader JARs Source: https://context7.com/pacifistmc/forgix/llms.txt Shows how to use the Forgix standalone JAR via the command line to merge multiple modloader JARs into a single file. It specifies the output path and individual modloader JARs. ```bash # Merge multiple modloader JARs into one java -jar forgix.jar mergeJars \ --output path/to/merged.jar \ --forge mymod-forge.jar \ --fabric mymod-fabric.jar \ --neoforge mymod-neoforge.jar ``` -------------------------------- ### Add Custom Modloaders with Forgix Gradle Plugin Source: https://context7.com/pacifistmc/forgix/llms.txt Demonstrates how to use the `merge()` method in the Forgix Gradle plugin to add support for custom modloaders or plugin platforms. It shows how to specify the input JAR for custom loaders. ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } forgix { archiveClassifier = "universal" // Standard loaders fabric() forge() // Add a custom modloader (project must be named "nyaLoader") merge("nyaLoader") // Add custom loader with specific input jar merge("customLoader") { inputJar = project(":customLoader").tasks.jar.archiveFile } // Add plugin platform with custom jar merge("myServerPlugin") { inputJar = project(":myServerPlugin").tasks.shadowJar.archiveFile } } // Project structure: // my-mod/ // ⌂- fabric/ // ⌂- forge/ // ⌂- nyaLoader/ <- Custom loader subproject // ⌂- customLoader/ <- Another custom loader // ⌂- build.gradle ``` -------------------------------- ### Configure Multiversion Merging with Forgix Gradle Plugin Source: https://context7.com/pacifistmc/forgix/llms.txt Details the `multiversion` configuration within the Forgix Gradle plugin. This allows merging JARs built for different Minecraft versions into a single JAR that selects the correct version at runtime. ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } forgix { multiversion { // Base name for the output file archiveBaseName = "my-mod" // Classifier added to the output filename archiveClassifier = "multi" // Version string for the output archiveVersion = project.version // Output directory destinationDirectory = layout.projectDirectory.dir("build/forgix/multiversion") // Input jars for different Minecraft versions inputJars = files( "build/libs/my-mod-1.18.2.jar", "build/libs/my-mod-1.19.4.jar", "build/libs/my-mod-1.20.1.jar", "build/libs/my-mod-1.21.1.jar" ) } } // Run: ./gradlew mergeVersions // Output: build/forgix/multiversion/my-mod-multi-.jar ``` -------------------------------- ### Apply Forgix Plugin with Gradle (Kotlin DSL) Source: https://github.com/pacifistmc/forgix/blob/main/README.md Applies the Forgix Gradle plugin using the plugins DSL in a Kotlin build script. This is the modern and preferred way to apply plugins in Kotlin-based Gradle projects. ```kotlin plugins { id("io.github.pacifistmc.forgix") version "" } ``` -------------------------------- ### Apply Forgix Plugin with Gradle (Kotlin Legacy) Source: https://github.com/pacifistmc/forgix/blob/main/README.md Applies the Forgix Gradle plugin using the legacy plugin application method in a Kotlin build script. This involves configuring the buildscript block and then applying the plugin. ```kotlin buildscript { repositories { maven { url = uri("https://plugins.gradle.org/m2/") } } dependencies { classpath("io.github.pacifistmc.forgix:Forgix:") } } apply(plugin = "io.github.pacifistmc.forgix") ``` -------------------------------- ### Apply Forgix Plugin with Gradle (Groovy DSL) Source: https://github.com/pacifistmc/forgix/blob/main/README.md Applies the Forgix Gradle plugin using the plugins DSL in a Groovy build script. This is the recommended way to apply plugins in modern Gradle projects. ```groovy plugins { id "io.github.pacifistmc.forgix" version "" } ``` -------------------------------- ### Configure Auto-Run for Forgix Gradle Plugin Source: https://context7.com/pacifistmc/forgix/llms.txt Explains how to enable the `autoRun` option in the Forgix Gradle plugin. When enabled, `mergeJars` will automatically execute after `gradle build` or `gradle assemble` on the root project. ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } forgix { // Enable automatic merging after build autoRun = true archiveClassifier = "merged" destinationDirectory = layout.projectDirectory.dir("build/merged") fabric() forge() neoforge() } // Now just run: // ./gradlew build // // This automatically runs mergeJars after all subprojects are built // Output: build/merged/my-mod-merged-.jar ``` -------------------------------- ### Configure Forgix Gradle Plugin for Multi-Platform Mod Source: https://context7.com/pacifistmc/forgix/llms.txt This Gradle Groovy script configures the Forgix plugin for a multi-platform Minecraft mod project. It sets up common project properties, defines support for various mod loaders (Fabric, Forge, NeoForge, Quilt) and server plugins (Paper, Velocity), and specifies output details for the universal JAR. ```groovy // root build.gradle plugins { id "io.github.pacifistmc.forgix" version "2.0.0-SNAPSHOT.5.1" } // Shared configuration for all subprojects subprojects { apply plugin: 'java' group = 'com.example' version = '1.0.0' java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } } forgix { silence = false autoRun = true archiveBaseName = rootProject.name archiveClassifier = "universal" archiveVersion = project.version destinationDirectory = layout.projectDirectory.dir("build/release") // Mod loaders fabric() forge { inputJar = project(":forge").tasks.shadowJar.archiveFile } neoforge() quilt() // Server plugins paper() velocity() } // Project structure: // my-awesome-mod/ // ├── common/ <- Shared code (optional) // │ │ build.gradle // ├── fabric/ // │ ├─ src/main/java/ // │ ├─ src/main/resources/fabric.mod.json // │ ─ build.gradle // ├── forge/ // │ ├─ src/main/java/ // │ ├─ src/main/resources/META-INF/mods.toml // │ ─ build.gradle // ├── neoforge/ // │ ├─ src/main/java/ // │ ├─ src/main/resources/META-INF/neoforge.mods.toml // │ ─ build.gradle // ├── quilt/ // │ ├─ src/main/java/ // │ ├─ src/main/resources/quilt.mod.json // │ ─ build.gradle // ├── paper/ // │ ├─ src/main/java/ // │ ─ src/main/resources/plugin.yml // │ ─ build.gradle // ├── velocity/ // │ ├─ src/main/java/ // │ ─ build.gradle // ├─ settings.gradle // ─ build.gradle <- This file // Build command: // ./gradlew build // // Output: build/release/my-awesome-mod-universal-1.0.0.jar // This single JAR works on Fabric, Forge, NeoForge, Quilt, Paper, and Velocity! ``` -------------------------------- ### Apply Forgix Plugin with Gradle (Groovy Legacy) Source: https://github.com/pacifistmc/forgix/blob/main/README.md Applies the Forgix Gradle plugin using the legacy plugin application method in a Groovy build script. This involves configuring the buildscript block and then applying the plugin. ```groovy buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "io.github.pacifistmc.forgix:Forgix:" } } apply plugin: "io.github.pacifistmc.forgix" ``` -------------------------------- ### Generic Merge Method for Custom Projects in Forgix Source: https://github.com/pacifistmc/forgix/blob/main/README.md Use the generic `merge()` method to specify and configure any custom project for integration with Forgix. This allows for custom loader names and specific input jar configurations. ```groovy forgix { // Simple usage with defaults merge("customLoader") // With configuration merge("customLoader") { inputJar = project(":customLoader").tasks.shadowJar.archiveFile } } ``` -------------------------------- ### Forgix.mergeVersions() API Source: https://context7.com/pacifistmc/forgix/llms.txt The core Java API for merging version-specific JARs into a single multiversion JAR. It automatically extracts Minecraft version ranges from mods.toml/neoforge.mods.toml. ```APIDOC ## Forgix.mergeVersions() API ### Description The core Java API for merging version-specific JARs. It automatically extracts Minecraft version ranges from mods.toml/neoforge.mods.toml and creates a multiversion JAR. ### Method ```java Forgix.mergeVersions(Collection jarFiles, File outputFile) ``` ### Parameters #### Path Parameters - **jarFiles** (Collection) - Required - A collection of version-specific JAR files to merge. - **outputFile** (File) - Required - The output file path for the multiversion JAR. ### Request Example ```java import io.github.pacifistmc.forgix.Forgix; import java.io.File; import java.util.Arrays; import java.util.Collection; public class MultiversionExample { public static void main(String[] args) { // Collection of version-specific JAR files Collection jarFiles = Arrays.asList( new File("mymod-1.18.2.jar"), new File("mymod-1.19.4.jar"), new File("mymod-1.20.1.jar"), new File("mymod-1.20.4.jar"), new File("mymod-1.21.1.jar") ); // Output file for the multiversion JAR File outputFile = new File("build/multiversion/mymod-universal.jar"); // Merge all versions into one JAR // Automatically reads version ranges from META-INF/mods.toml // or META-INF/neoforge.mods.toml in each JAR Forgix.mergeVersions(jarFiles, outputFile); } } ``` ### Response #### Success Response (200) - **outputFile** (File) - The generated multiversion JAR file. #### Response Example (No direct response body, but the `outputFile` is created.) ``` build/multiversion/mymod-universal.jar ``` ### Notes - The output JAR will contain a shared library JAR with common files and version-specific JARs for unique files. - It automatically selects the correct version at runtime based on the Minecraft version. ``` -------------------------------- ### Configure Modloaders and Plugins with Forgix Source: https://github.com/pacifistmc/forgix/blob/main/README.md Configure various modloaders and plugin platforms supported by Forgix. This can be done with simple default calls or by providing a configuration block for specific settings like `inputJar`. ```groovy forgix { // Simple usage with defaults fabric() // With configuration forge { inputJar = project(":forge").tasks.shadowJar.archiveFile } } ``` -------------------------------- ### Merge Version-Specific JARs using Forgix Java API Source: https://context7.com/pacifistmc/forgix/llms.txt This Java code snippet demonstrates how to use the Forgix API to merge multiple version-specific JAR files into a single multiversion JAR. It automatically extracts version ranges from `mods.toml` or `neoforge.mods.toml` files within the input JARs. ```java import io.github.pacifistmc.forgix.Forgix; import java.io.File; import java.util.Arrays; import java.util.Collection; public class MultiversionExample { public static void main(String[] args) { // Collection of version-specific JAR files Collection jarFiles = Arrays.asList( new File("mymod-1.18.2.jar"), new File("mymod-1.19.4.jar"), new File("mymod-1.20.1.jar"), new File("mymod-1.20.4.jar"), new File("mymod-1.21.1.jar") ); // Output file for the multiversion JAR File outputFile = new File("build/multiversion/mymod-universal.jar"); // Merge all versions into one JAR // Automatically reads version ranges from META-INF/mods.toml // or META-INF/neoforge.mods.toml in each JAR Forgix.mergeVersions(jarFiles, outputFile); // The output JAR will: // - Contain a shared library JAR with common files // - Contain version-specific JARs for unique files // - Auto-select the correct version at runtime based on Minecraft version } } ``` -------------------------------- ### Enable Automatic Task Execution in Forgix Source: https://github.com/pacifistmc/forgix/blob/main/README.md Configure Forgix to automatically run tasks like `mergeJars` when the global `assemble` or `build` tasks are executed. Set `autoRun` to `true` to enable this behavior. ```groovy forgix { autoRun = true } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.