Loom allows semi-automatic updating of the mappings used in a Java codebase. Due to frequent changes in Yarn, this can be a useful tool for keeping a codebase up-to-date with the newest changes.
Note: This automated process currently does not handle Mixins or reflection, instances of these will need to be manually updated.
Say you want to migrate from 1.16.5 yarn to 1.17.1 yarn.
gradlew migrateMappings --mappings "1.17.1+build.40"
. DO NOT modify your gradle.properties or build.gradle yet. remappedSrc
. Verify that the migration produced valid migrated code.remappedSrc
to the original folder. Keep the original sources backed up just in case.
If you want to go from Mojang's official mappings, AKA mojmap, to yarn, make sure your mappings in build.gradle
is set to loom.officialMojangMappings()
before running migrateMappings
. For more information, check out the dedicated Mappings page.
--input path/to/source
. Default: src/main/java
.--output path/to/output
. Default: 'remappedSrc'. You can use src/main/java
here to avoid having to copy the remapped classes, but make sure you have a backup.--mappings some_group:some_artifact:some_version:some_qualifier
. Default: net.fabricmc:yarn:<version-you-inputted>:v2
. Use net.minecraft:mappings:<minecraft-version>
to migrate to official Mojang mappings.Loom uses Mercury to remap Java source code, for problems with remapping please report issues to their issue tracker, or discuss it through their communications channel (irc.esper.net #cadix).
Some assembly required.
gradle migrateMappings -PtargetMappingsArtifact="net.fabricmc:yarn:1.14.1 Pre-Release 2+build.2" -PinputDir=src/main/java -PoutputDir=remappedSrc
, where:Note: You may need to specify the full paths in quotes, try this if you get file not found issues.
This should work across Minecraft versions as well, provided we haven't massively broken Intermediaries or done something equally silly (aka: most of the time).