rename project, fix handling multi-release jars

This commit is contained in:
moehreag 2024-05-28 01:43:04 +02:00
parent a0a5f6cf2f
commit 1187039f90
2 changed files with 12 additions and 10 deletions

View file

@ -1,2 +1,2 @@
rootProject.name = "nonsense-remapper" rootProject.name = "thyroxine"

View file

@ -22,7 +22,7 @@ import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.ClassRemapper; import org.objectweb.asm.commons.ClassRemapper;
public class NonsenseRemapper { public class Thyroxine {
public static void run(String minecraftVersion, Path inputJar, Path outputJar, boolean skipMetaInf, boolean renameParameters) throws IOException, InterruptedException { public static void run(String minecraftVersion, Path inputJar, Path outputJar, boolean skipMetaInf, boolean renameParameters) throws IOException, InterruptedException {
MappingData data = ProguardParser.read(MojmapProvider.get(minecraftVersion, MappingData data = ProguardParser.read(MojmapProvider.get(minecraftVersion,
@ -50,19 +50,21 @@ public class NonsenseRemapper {
Map<String, List<String>> lazyParents = new ConcurrentHashMap<>(); Map<String, List<String>> lazyParents = new ConcurrentHashMap<>();
Mapper mapper = new Mapper(data, className -> lazyParents.computeIfAbsent(className, ignored -> Mapper mapper = new Mapper(data, className -> lazyParents.computeIfAbsent(className, ignored ->
NonsenseRemapper.computeInheritances(className, inFs))); Thyroxine.computeInheritances(className, inFs)));
Files.walkFileTree(inFs.getPath("/"), new SimpleFileVisitor<>() { Files.walkFileTree(inFs.getPath("/"), new SimpleFileVisitor<>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
if (skipMetaInf && dir.startsWith("/META-INF")) {
return FileVisitResult.SKIP_SUBTREE;
}
return FileVisitResult.CONTINUE;
}
@Override @Override
public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) { public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) {
if (skipMetaInf) {
if (path.startsWith("/META-INF")) {
var name = path.getFileName().toString();
if (name.endsWith(".MF") || name.endsWith(".SF") || name.endsWith(".RSA")) {
return FileVisitResult.CONTINUE;
}
}
}
tasks.add(() -> { tasks.add(() -> {
try { try {
if (path.getFileName().toString().endsWith(".class")) { if (path.getFileName().toString().endsWith(".class")) {