Skip to content

Commit ae9e3f4

Browse files
committed
Version 2.0.0
1 parent 5e5a543 commit ae9e3f4

24 files changed

+650
-621
lines changed

README.md

Lines changed: 59 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -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

build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@ plugins {
55
}
66

77
group 'com.pocolifo'
8-
version '1.0.0'
8+
version '2.0.0'
99

10-
sourceCompatibility = targetCompatibility = 1.8
10+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
1111

1212
repositories {
1313
mavenCentral()
1414
}
1515

1616
dependencies {
1717
implementation 'org.ow2.asm:asm-commons:9.2'
18-
implementation 'commons-io:commons-io:2.11.0'
1918

20-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
21-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
19+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
20+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
2221
}
2322

2423
test {
@@ -31,7 +30,7 @@ publishing {
3130
pom {
3231
name = 'JAR Remapper'
3332
description = 'Library for remapping JARs'
34-
artifactId = 'jarremapper'
33+
artifactId = 'jar-remapper'
3534

3635
licenses {
3736
license {

0 commit comments

Comments
 (0)