add method for direct invocation
This commit is contained in:
parent
70117f8873
commit
ff6ce3210b
|
@ -5,7 +5,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "org.ecorous.esnesnon"
|
||||
version = "1.0-SNAPSHOT"
|
||||
version = "1.0.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
@ -14,28 +14,17 @@ import java.nio.file.attribute.BasicFileAttributes;
|
|||
|
||||
public class MojMapPatcher {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// temporary
|
||||
if (args.length != 3) {
|
||||
System.err.println("Usage: [minecraft-version] [minecraft.jar] [out.jar]");
|
||||
return;
|
||||
}
|
||||
|
||||
String minecraftVersion = args[0];
|
||||
String minecraftJar = args[1];
|
||||
String outJar = args[2];
|
||||
|
||||
public static void run(String minecraftVersion, Path inputJar, Path outputJar) throws IOException {
|
||||
MappingData data = ProguardParser.read(MojmapProvider.get(minecraftVersion).orElseThrow()).reverse();
|
||||
|
||||
Mapper mapper = new Mapper(data);
|
||||
|
||||
Path out = Paths.get(outJar);
|
||||
if (!Files.exists(out)){
|
||||
Files.createFile(out);
|
||||
if (!Files.exists(outputJar)){
|
||||
Files.createFile(outputJar);
|
||||
}
|
||||
|
||||
try (FileSystem inFs = FileSystems.newFileSystem(Paths.get(minecraftJar));
|
||||
FileSystem outFs = FileSystems.newFileSystem(out)){
|
||||
try (FileSystem inFs = FileSystems.newFileSystem(inputJar);
|
||||
FileSystem outFs = FileSystems.newFileSystem(outputJar)){
|
||||
Files.walkFileTree(inFs.getPath(""), new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) throws IOException {
|
||||
|
@ -57,4 +46,19 @@ public class MojMapPatcher {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// temporary
|
||||
if (args.length != 3) {
|
||||
System.err.println("Usage: [minecraft-version] [minecraft.jar] [out.jar]");
|
||||
return;
|
||||
}
|
||||
|
||||
String minecraftVersion = args[0];
|
||||
String minecraftJar = args[1];
|
||||
String outJar = args[2];
|
||||
|
||||
run(minecraftVersion, Paths.get(minecraftJar), Paths.get(outJar));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue