add optional parameter to skip META-INF
All checks were successful
Publish to snapshot maven / build (push) Successful in 49s
All checks were successful
Publish to snapshot maven / build (push) Successful in 49s
This commit is contained in:
parent
af4af1ba29
commit
80d2ef41e0
|
@ -18,7 +18,7 @@ import org.objectweb.asm.commons.ClassRemapper;
|
|||
|
||||
public class MojMapPatcher {
|
||||
|
||||
public static void run(String minecraftVersion, Path inputJar, Path outputJar) throws IOException, InterruptedException {
|
||||
public static void run(String minecraftVersion, Path inputJar, Path outputJar, boolean skipMetaInf) throws IOException, InterruptedException {
|
||||
MappingData data = ProguardParser.read(MojmapProvider.get(minecraftVersion).orElseThrow()).reverse();
|
||||
|
||||
Mapper mapper = new Mapper(data);
|
||||
|
@ -36,7 +36,11 @@ public class MojMapPatcher {
|
|||
|
||||
Files.walkFileTree(inFs.getPath("/"), new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) throws IOException {
|
||||
public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) {
|
||||
if (skipMetaInf && path.startsWith("/META-INF")){
|
||||
return FileVisitResult.SKIP_SUBTREE;
|
||||
}
|
||||
|
||||
tasks.add(() -> {
|
||||
try {
|
||||
if (path.getFileName().toString().endsWith(".class")) {
|
||||
|
@ -74,16 +78,17 @@ public class MojMapPatcher {
|
|||
|
||||
public static void main(String[] args) throws IOException, InterruptedException {
|
||||
// temporary
|
||||
if (args.length != 3) {
|
||||
System.err.println("Usage: [minecraft-version] [minecraft.jar] [out.jar]");
|
||||
if (args.length < 3 || args.length > 4) {
|
||||
System.err.println("Usage: [minecraft-version] [minecraft.jar] [out.jar] <--remove-meta-inf>");
|
||||
return;
|
||||
}
|
||||
|
||||
String minecraftVersion = args[0];
|
||||
String minecraftJar = args[1];
|
||||
String outJar = args[2];
|
||||
boolean removeMetaInf = args.length > 3 && "--remove-meta-inf".equals(args[3]);
|
||||
|
||||
run(minecraftVersion, Paths.get(minecraftJar), Paths.get(outJar));
|
||||
run(minecraftVersion, Paths.get(minecraftJar), Paths.get(outJar), removeMetaInf);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue