Mapping-IO is a small and efficient library for working with deobfuscation mapping files. It has readers and writers for numerous formats, and provides extensive mapping manipulation facilities.
The API is inspired by ObjectWeb's ASM: At its core, Mapping-IO is visitor-based, but it also provides a tree API for in-memory storage and easier data manipulation.
Utilities for more sophisticated use cases can be found in the mapping-io-extras module; they've been moved out from the core publication due to their additional dependencies.
Reading and writing can be easily achieved via the MappingReader
and MappingWriter
interfaces:
MappingReader.read(inputPath, /* optional */ inputFormat,
MappingWriter.create(outputPath, outputFormat));
The above example reads mappings from the input path directly into a MappingWriter
, writing all contents to disk in the specified format.
Keep in mind that the conversion process might be lossy if the two formats' feature sets differ; see the comparison table here for more details.
You can also read into a tree first:
VisitableMappingTree tree = new MemoryMappingTree();
MappingReader.read(inputPath, inputFormat, tree);
tree.accept(MappingWriter.create(outputPath, outputFormat));
If the input format is known beforehand and more direct control over specific reading parameters is desired, the formats' readers (or writers) may also be invoked directly.
Mapping manipulation is achieved either via the tree API or specialized MappingVisitor
s, hand-crafted or utilizing first-party ones found in the adapter package.
For further information, please consult the project's Javadocs.
Mapping-IO is available from the FabricMC Maven, version 0.4.2 and onwards can also be found on Maven Central.
Gradle snippet:
repositories {
mavenCentral()
}
dependencies {
api 'net.fabricmc:mapping-io:${mappingio_version}'
}