documentation:fabric_loom
This is an old revision of the document!
Table of Contents
Fabric Loom
Fabric Loom, or just Loom for short, is a Gradle plugin for development of mods in the Fabric ecosystem. Loom provides utilities to install Minecraft and mods in a development environment so that you can link against them with respect to Minecraft obfuscation and its differences between distributions and versions. It also provides run configurations for use with Fabric Loader, Mixin compile processing and utilities for Fabric Loader's jar-in-jar system.
Dependency configurations
minecraft
: Defines the version of Minecraft to be used in the development environment.mappings
: Defines the mappings to be used in the development environment.modCompile
,modImplementation
,modApi
andmodRuntime
: Augmented variants ofcompile
,implementation
,api
andruntime
for dependencies that should be remapped to match the mappings in the development environment, generally for depending on mods.include
: Declares a dependency that should be included as a jar-in-jar in theremapJar
output. This dependency configuration is not transitive.
Default tasks
cleanLoomBinaries
: For the configured version of Minecraft and the configured mappings, deletes the merged Minecraft jar, the intermediary Minecraft jar and the mapped Minecraft jar from the user cache.cleanLoomMappings
: For the configured version of Minecraft and the configured mappings, deletes the mappings, the intermediary Minecraft jar and the mapped Minecraft jar from the user cache. Also clears the root project build cache.migrateMappings
: Migrates the current source to the specified mappings. See migratemappings.remapJar
: Produces a jar containing the remapped output of thejar
task. Also appends any included mods for jar-in-jar.genSources
: Delegates to two tasks.genSourcesDecompile
decompiles the mapped Minecraft jar using FernFlower to create a sources jar and additionally generates a linemap.genSourcesRemapLineNumbers
then applies the generated linemap to produce a linemapped jar which re-aligns line numbers in the binary and source jars. The linemapped jar replaces the mapped jar.downloadAssets
: Downloads the asset index and asset objects for the configured version of Minecraft into the user cache.genIdeaWorkspace
: Depends onidea
andgenSources
. Installs run configurations in the ItelliJ project of the root project and creates the run directory if it does not already exist.genEclipseRuns
: Depends ongenSources
. Installs Eclipse run configurations and creates the run directory if it does not already exist.vscode
: Depends ongenSources
. Generates or overwrites a Visual Studio Codelaunch.json
file with launch configurations in the.vscode
directory and creates the run directory if it does not already exist.remapSourcesJar
: Only exists if an AbstractArchiveTasksourcesJar
exists. Produces a jar containing the remapped output of thesourcesJar
.runClient
: A JavaExec task to launch Fabric Loader as a Minecraft client.runServer
: A JavaExec task to launch Fabric Loader as a Minecraft dedicated server.
Default configuration
- Applies the following plugins:
java
,eclipse
andidea
. - Adds the following Maven repositories: Fabric https://maven.fabricmc.net/, Mojang https://libraries.minecraft.net/, Maven Central and JCenter.
- Configures
idea
extension to exclude directories.gradle
,build
,.idea
andout
, to download javadocs sources and to inherit output directories. - Configures the
idea
andeclipse
tasks to be finalized bygenIdeaWorkspace
andgenEclipseRuns
respectively. - Adds
net.fabricmc:fabric-mixin-compile-extensions
and its dependencies with theannotationProcessor
dependency configuration. - Adds the output of
remapJar
as anarchives
artifact andremapJar
is made a dependency ofbuild
. - If an AbstractArchiveTask
sourcesJar
exists, adds the output ofremapSourcesJar
task as anarchives
artifact andremapSourcesJar
is made a dependency ofbuild
.
Run configurations are generated from the fabric-installer.json file of Fabric Loader if it installed as a dependency.
Publishing
Useful task types
net.fabricmc.loom.task.RemapJarTask
net.fabricmc.loom.task.RemapSourcesJarTask
The development environment
Loom does quite a few things behind the scenes to create a development environment with Minecraft.
- Downloads the client and server jar from official channels for the configured version of Minecraft.
- Merges the client and server jar to produce a merged jar with
@Environment
and@EnvironmentInterface
annotations. - Downloads the configured mappings.
- Remaps the merged jar with intermediary mappings to produce an intermediary jar.
- Remaps the intermediary jar with yarn mappings to produce a mapped jar.
- Optional: Decompiles the mapped jar to produce a mapped sources jar and linemap, and applies the linemap to the mapped jar.
- Adds dependencies of Minecraft.
- Downloads Minecraft assets.
- Remaps mod-augmented dependencies.
Caches
${GRADLE_HOME}/caches/fabric-loom
: The user cache, a cache shared by all Loom projects for a user. Used to cache Minecraft assets, jars, merged jars, intermediary jars and mapped jars..gradle/loom-cache
: The root project persistent cache, a cache shared by a project and its subprojects. Used to cache remapped mods as well as generated included mod jars.build/loom-cache
: The root project build cache.**/build/loom-cache
: The (sub)project build cache.
documentation/fabric_loom.1559943593.txt.gz · Last modified: 2019/06/07 21:39 by jamieswhiteshirt