Minecraft Mappings | |
Created by | jonafanho |
Repository | Minecraft-Mappings |
Supported Mod Loader | Fabric Forge |
Supported Minecraft Version | 1.16.5 1.17.1 1.18.2 1.19.2 1.19.4 1.20.1 1.20.4 |
Development Status | No future MC version will be added |
Used by | Minecraft Transit Railway 4.0.0 |
Addon mods designed for MTR 4.0.0 |
Minecraft Mappings is a project made for the MTR Mod that allows cross version (1.16.5+) and mod-loader compatibility with 1 single codebase.
There is no plan to continue expanding support for new version/modloader due to the number of breaking changes made by Mojang.
When MTR gains support for version above 1.20.4, it will likely be based on Architectury for multi-loader support, and multi-version support will be dropped entirely.
Minecraft Mappings are compiled to a jar for each Minecraft version and Mod Loader. (So for example, 1.16.5-fabric, 1.16.5-forge, 1.17.1-fabric, 1.17.1-forge etc.)
Inside of these jars, it contains classes and methods that often wraps around Minecraft's native code. These classes and method signature are all unchanged across different jars, and only the underlying implementation is changed to adapt to different Minecraft version. This makes it possible to compile your mod by targeting a single codebase by simply swapping the jar dependencies
The idea is that you don't use Minecraft's code, instead use all the wrapper classes/method provided by Minecraft Mappings. (Which usually has the same name as Yarn mapping, under the org.mtr.mapping
package). This means you have to swap all the native Minecraft classes to the Minecraft Mapping Equivalent.
Note that not all method and classes can be mapped, for example one method could exist in 1.18.2 but not 1.17.1.
As such, method that are guaranteed to exist across all version will be annotated with @MappedMethod
, whereas other method that may not exist across all versions and mod-loaders will be annotated with @Deprecated
(In which your IDE should give you a warning), don't use anything that's marked as deprecated as they may fail to compile across all versions and platform.
When overriding method on classes provided by Minecraft Mappings, you should be overriding and calling methods made by Minecraft-Mappings (Sometimes named like methodName2
or methodName3
), these are methods provided by Minecraft Mappings, whereas methodName
is usually the underlying method provided by Minecraft.
Minecraft Mappings also provide helper classes (For example the Vanilla Registry) on components with radical changes between versions.
The RenderSystem class is a bit special, as in it is not obfuscated like the rest of the Minecraft code. As such there's no need for different mapping like Yarn or Mojmap, and there's a much less chance that the method name will differ across mod-loaders due to them using different mappings.
Consider checking open source addon mods made for MTR 4 for implementation detail.
Note that you should no longer count on this project updating to newer Minecraft version.