Table of Contents
A more thorough documentation of the process of migrating mappings, along with better, specific tooling is currently planned for the near future in order to help the transition into the non-obfuscated MC versions. This page will likely redirect to the proper documentation once it is in a satisfying state.
Migrating to Yarn or Mojang Mappings in a Java codebase
Loom allows semi-automatic updating of the mappings used in a Java codebase. This can be a useful tool for users wishing to keep their codebase up-to-date with the new changes in Yarn, or for users wishing to change to different mappings, including Mojang's own mappings. For more information, check out the dedicated Mappings page.
Loom does not support migrating code written in Kotlin. Third party tools are available.
Note: This automated process does not yet handle Mixins or reflection. Updated tooling is currently in the works that will fix these errors. This tooling will be available before the mandatory switch to Mojang names in a future version of Minecraft.
Migrating to Mojang Mappings
These instructions cover migration from Yarn to Mojang Mappings.
- You'll need a command to migrate your mappings to Mojang Mappings, for example
gradlew migrateMappings --mappings "net.minecraft:mappings:1.21.10". Replace1.21.10with the version of Minecraft you are migrating from. This must be the same version of Minecraft you are currently running. DO NOT modify yourgradle.propertiesorbuild.gradleyet. - Run the command in the root of your Gradle project, either through the terminal, or by adding it as a run configuration in IntelliJ Idea.
- Your migrated sources will appear in
remappedSrc. Verify that the migration produced valid migrated code. - Copy the sources from
remappedSrcto the original folder. Keep the original sources backed up just in case. - If you are coming from Yarn, you can now replace your mappings in your
build.gradle's dependencies section with Mojang Mappings (i.e. mappingsloom.officialMojangMappings()). - Refresh the Gradle project in your IDE.
- Check and update any Mixin targets that may be outdated.
Your dependencies section should now contain this:
dependencies {
[...]
mappings loom.officialMojangMappings()
}
Migrating to Yarn
These instructions cover migration from Mojang Mappings (or an older version of Yarn) to Yarn.
- Go to the Fabric Develop Site, select the version to migrate to, and copy the Gradle command under “Mappings Migration”, for example
gradlew migrateMappings --mappings "1.21.10+build.2". DO NOT modify yourgradle.propertiesorbuild.gradleyet. - Run the command in the root of your Gradle project, either through the terminal, or by adding it as a run configuration in IntelliJ Idea.
- Your migrated sources will appear in
remappedSrc. Verify that the migration produced valid migrated code. - Copy the sources from
remappedSrcto the original folder. Keep the original sources backed up just in case. - Update or add to your
gradle.propertiesfile with the Yarn version specified on the Develop site, i.e.yarn_mappings=1.21.10+build.2. - If you are coming from Mojang Mappings, you can now replace your mappings in your
build.gradle's dependency section with Yarn's (i.e.mappings “net.fabricmc:yarn${project.yarn_mappings}:v2”) - Refresh the Gradle project in your IDE.
- Check and update any Mixin targets that may be outdated.
Your dependencies section should now contain this, with the version of Yarn you are using specified in your gradle.properties:
dependencies {
[...]
mappings "net.fabricmc:yarn${project.yarn_mappings}:v2"
}
Migrating Split Sources
At this time, users of split sources currently need to migrate their main source set with the process above, then do the process again, specifying the path to their client source set. As a reference, the command to migrate a client source set to Mojang Mappings is below.
migrateMappings --mappings "net.minecraft:mappings:1.21.10" --input src/client/java
Additional customization
- Specify from where to take your Java files with
--input path/to/source. Default:src/main/java. - Specify where to output the remapped source with
--output path/to/output. Default: 'remappedSrc'. You can usesrc/main/javahere to avoid having to copy the remapped classes, but make sure you have a backup. - Specify a custom place to retrieve the mappings from with
--mappings some_group:some_artifact:some_version:some_qualifier. Default:net.fabricmc:yarn:<version-you-inputted>:v2. Usenet.minecraft:mappings:<minecraft-version>to migrate to official Mojang mappings.
Reporting issues
Loom uses a fork of Mercury to remap Java source code, for problems with remapping please report issues to its issue tracker.