@@ -4,117 +4,85 @@ Making remapping JARs easy, organized, and painless
44
55## Features
66
7+ #### Remapping Engines
8+ - Multiple different engines to remap JARs
9+ - StandardRemappingEngine by the devs of JAR Remapper
10+ - FabricMC's TinyRemapper using a Remapping Engine (* requires extension dependency* )
11+
712#### Remapping
813- Class remapping
914- Method remapping
1015- Field remapping
1116- Parameter remapping
1217
13- #### Common Minecraft mapping formats
14- - Built-in SRG/MCP mapping support
15- - Built-in Yarn v1 & v2-merged mapping support
18+ #### Common mapping formats
19+ - Built-in ModCoderPack's SRG/MCP mapping support
20+ - Built-in Tiny v1/v2 mapping support
1621
1722#### Flexible API
18- - Remapping plugins
19- - Automatically exclude ` META-INF ` directory from output JAR
20- - Read your own mappings
23+ - Custom Mapping Readers
24+ - Custom Remapping Engines
2125
2226## Coming Soon
23-
24- - Local variable remapping
2527- Built-in Proguard mapping support
26- - Multithreaded remapping
28+
2729
2830# Getting Started
2931
30- Simply read some mappings
32+ Load in your favorite mapping format
3133
3234``` java
33- // mcp mappings
34- McpMappingReader reader = new McpMappingReader (
35- new File (" joined.srg" ),
36- new File (" joined.exc" ),
37-
38- new File (" methods.csv" ),
39- new File (" fields.csv" ),
40- new File (" params.csv" )
41- );
42-
43- // yarn v1 mappings
44- YarnV1MappingReader reader = new YarnV1MappingReader (
45- new File (" mappings-1.17.1.tiny" )
46- );
47-
48- // yarn v2 merged mappings
49- YarnMergedV2MappingReader reader = new YarnMergedV2MappingReader (
50- new File (" mappings-merged-v2-1.17.1.tiny" )
51- );
52-
53- // read the mappings
54- JarMapping jarMapping = reader. read();
35+ JarMapping mappings;
36+
37+ // MCP mappings
38+ mappings = new McpMappingReader (
39+ new File (" joined.srg" ),
40+ new File (" joined.exc" ),
41+
42+ new File (" methods.csv" ),
43+ new File (" fields.csv" ),
44+ new File (" params.csv" )
45+ ). read();
46+
47+ // Tiny v1 mappings
48+ mappings = new Tiny1MappingReader (
49+ new File (" mappings-tiny-v1.tiny" )
50+ ). read(" remapFromThisNamespace" , " remapToThisNamespace" );
51+
52+ // Tiny v2 mappings
53+ mappings = new Tiny2MappingReader (
54+ new File (" mappings-tiny-v2.tiny" )
55+ ). read(" remapFromThisNamespace" , " remapToThisNamespace" );
5556```
5657
57- Then, remap the JAR like so
58-
59- ``` java
60- JarRemapper . newBuilder()
61- // (required)
62- // Set input (not remapped) JAR
63- .setInputFile(new File (" minecraft.jar" ))
64-
65- // (required)
66- // Read and set the mappings we will remap with
67- .setJarMapping(jarMapping)
68-
69- // (required)
70- // Set the output (remapped) JAR
71- .setOutputFile(new File (" minecraft-deobfuscated.jar" ))
72-
73- // (optional)
74- // Set a remapping plugin (see SimpleProgressListener above)
75- .setRemappingPlugin(new SimpleProgressListener ())
76-
77- // (optional)
78- // Exclude the META-INF directory from the output JAR
79- .excludeMetaInf()
80-
81- // Remap the JAR!
82- .remap();
83- ```
84-
85- # Code snippets
86-
87- Simple remapping plugin for tracking progress
58+ With your mappings, remap your JAR file
8859
8960``` java
90- import com.pocolifo.jarremapper.mapping.ClassMapping ;
91- import com.pocolifo.jarremapper.plugin.IRemappingPlugin ;
92-
93- import java.util.zip.ZipFile ;
94-
95- public class SimpleProgressListener implements IRemappingPlugin {
96-
97- @Override
98- public void onBeginRemap (ZipFile remappingJar ) {
99- System . out. println(" Beginning remap" );
100- }
101-
102- @Override
103- public void onBeforeRemapClass (ClassMapping classMapping ) {
104- System . out. println(" Just about to remap a class..." );
105- }
106-
107- @Override
108- public void onAfterRemapClass (ClassMapping classRemapped ) {
109- System . out. println(" Just finished remapping a class!" );
110- }
111-
112- @Override
113- public void onDoneRemap () {
114- System . out. println(" All classes remapped!" );
115- }
116-
117- }
61+ JarRemapper . newRemap()
62+ // (required)
63+ // The JAR to be remap
64+ .withInputFile(new File (" input.jar" ))
65+
66+ // (required)
67+ // The output of the remapped JAR
68+ .withOutputFile(new File (" output.jar" ))
69+
70+ // (required)
71+ // The mappings to remap the JAR with
72+ .withMappings(mappings)
73+
74+ // (optional)
75+ // The Remapping Engine to remap the JAR with
76+ // default: StandardRemappingEngine
77+ .withRemappingEngine(new StandardRemappingEngine ())
78+
79+ // (optional)
80+ // Automatically deletes the output file before remapping
81+ // default: false
82+ .overwriteOutputFile()
83+
84+ // Begin remapping the JAR!
85+ .remap();
11886```
11987
12088# Develop
0 commit comments