User Tools

Site Tools


documentation:fabric_loom

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
documentation:fabric_loom [2023/02/17 21:23] modmuss50documentation:fabric_loom [2023/12/22 14:39] (current) – Remove confusion around loom extracting nested jars. modmuss50
Line 11: Line 11:
   * ''genEclipseRuns'': Installs Eclipse run configurations and creates the run directory if it does not already exist.   * ''genEclipseRuns'': Installs Eclipse run configurations and creates the run directory if it does not already exist.
   * ''vscode'': Generates or overwrites a Visual Studio Code ''launch.json'' file with launch configurations in the ''.vscode'' directory and creates the run directory if it does not already exist.   * ''vscode'': Generates or overwrites a Visual Studio Code ''launch.json'' file with launch configurations in the ''.vscode'' directory and creates the run directory if it does not already exist.
 +  * ''ideaSyncTask'': Generates (but not overrides) the Intellij IDEA launch config, including client and server by default.
   * ''remapSourcesJar'': Only exists if an AbstractArchiveTask ''sourcesJar'' exists. Remaps the output of the ''sourcesJar'' task in place.   * ''remapSourcesJar'': Only exists if an AbstractArchiveTask ''sourcesJar'' exists. Remaps the output of the ''sourcesJar'' task in place.
   * ''runClient'': A JavaExec task to launch Fabric Loader as a Minecraft client.   * ''runClient'': A JavaExec task to launch Fabric Loader as a Minecraft client.
Line 22: Line 23:
 dependencies { dependencies {
  implementation project(path: ":name", configuration: "namedElements")  implementation project(path: ":name", configuration: "namedElements")
 +}
 +</code>
 +
 +If you are using splitsource sets in a multi-project build, you will also need to add a dependency for the other projects client sourceset.
 +
 +<code>
 +dependencies {
 + clientImplementation project(":name").sourceSets.client.output
 } }
 </code> </code>
Line 30: Line 39:
  
 The following snippet from a build.gradle file shows how you can enable this for your mod. As your mod will now be split across two sourcesets, you will need to use the new DSL to define your mods sourcesets. This enables Fabric Loader to group your mods classpath together. This is also useful for some other complex multi-project setups. The following snippet from a build.gradle file shows how you can enable this for your mod. As your mod will now be split across two sourcesets, you will need to use the new DSL to define your mods sourcesets. This enables Fabric Loader to group your mods classpath together. This is also useful for some other complex multi-project setups.
 +
 +Minecraft 1.18 (1.19 recommended), Loader 0.14 and Loom 1.0 or later are required to split the client and common code.
  
 <code> <code>
Line 46: Line 57:
 ==== Multi project Optimisation ==== ==== Multi project Optimisation ====
  
-If your Gradle project has many subprojects that use the same Minecraft version such as Fabric-API, starting with Loom 1.1 you can now opt-in to advanced optimistations. Adding <code>fabric.loom.multiProjectOptimisation=true</code> to the settings.gradle file will help decrease build time and memory usage by sharing the Tiny Remapper instance between projects when remapping your output jars.+If your Gradle project has many subprojects that use the same Minecraft version such as Fabric-API, starting with Loom 1.1 you can now opt-in to advanced optimistations. Adding <code>fabric.loom.multiProjectOptimisation=true</code> to the gradle.properties file will help decrease build time and memory usage by sharing the Tiny Remapper instance between projects when remapping your output jars.
  
 ==== Options ==== ==== Options ====
Line 237: Line 248:
 ==== Resolving issues ==== ==== Resolving issues ====
  
-Loom and/or gradle can sometimes fail due to corrupted cache files. Running ''./gradlew build --refresh-dependencies'' will force gradle and loom to re-download and recreate all of the files. This may take a few minutes but is usually quite successful with resolving cache related issues.+Loom and/or gradle can sometimes fail due to corrupted cache files. Running ''./gradlew build <nowiki>--</nowiki>refresh-dependencies'' will force gradle and loom to re-download and recreate all of the files. This may take a few minutes but is usually quite successful with resolving cache related issues.
  
 ==== Development environment setup ==== ==== Development environment setup ====
Line 251: Line 262:
   - Adds dependencies of Minecraft.   - Adds dependencies of Minecraft.
   - Downloads Minecraft assets.   - Downloads Minecraft assets.
-  - Processes and includes mod-augmented dependencies (and optionally extracts and remaps nested JARs).+  - Processes and includes mod-augmented dependencies.
  
 ==== Caches ==== ==== Caches ====
Line 264: Line 275:
   * ''minecraft'': Defines the version of Minecraft to be used in the development environment.    * ''minecraft'': Defines the version of Minecraft to be used in the development environment. 
   * ''mappings'': Defines the mappings to be used in the development environment.   * ''mappings'': Defines the mappings to be used in the development environment.
-  * ''modCompile'', ''modImplementation'', ''modApi'' and ''modRuntime'': Augmented variants of ''compile'', ''implementation'', ''api'' and ''runtime'' for mod dependencies. Will be remapped to match the mappings in the development environment and has any nested JARs removed. Nested JARs can optionally be extracted and remapped.+  * ''modCompile'', ''modImplementation'', ''modApi'' and ''modRuntime'': Augmented variants of ''compile'', ''implementation'', ''api'' and ''runtime'' for mod dependencies. Will be remapped to match the mappings in the development environment and has any nested JARs removed.
   * ''include'': Declares a dependency that should be included as a jar-in-jar in the ''remapJar'' output. This dependency configuration is not transitive. For non-mod dependencies, Loom will generate a mod JAR with a fabric.mod.json using the name as the mod ID and the same version.   * ''include'': Declares a dependency that should be included as a jar-in-jar in the ''remapJar'' output. This dependency configuration is not transitive. For non-mod dependencies, Loom will generate a mod JAR with a fabric.mod.json using the name as the mod ID and the same version.
  
documentation/fabric_loom.1676669028.txt.gz · Last modified: 2023/02/17 21:23 by modmuss50