Fix nested jar stripping not working reliability

dev/0.11
modmuss50 2020-09-19 14:57:17 +01:00
parent 80aaf63832
commit d5ed659e7d
1 changed files with 13 additions and 6 deletions

View File

@ -33,6 +33,7 @@ import java.io.InputStreamReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -68,24 +69,30 @@ public class ModProcessor {
return; return;
} }
ArrayList<ModDependencyInfo> remapList = new ArrayList<>();
for (ModDependencyInfo info : processList) { for (ModDependencyInfo info : processList) {
if (info.requiresRemapping() && info.getRemappedOutput().exists()) { if (info.requiresRemapping()) {
if (info.getRemappedOutput().exists()) {
info.getRemappedOutput().delete(); info.getRemappedOutput().delete();
} }
remapList.add(info);
}
} }
remapJars(project, processList); remapJars(project, processList);
for (ModDependencyInfo info : processList) { for (ModDependencyInfo info : processList) {
if (!info.getRemappedOutput().exists()) { if (!info.getRemappedOutput().exists()) {
throw new RuntimeException("Failed to remap mod" + info); throw new RuntimeException("Failed to find remapped mod" + info);
}
} }
if (info.requiresRemapping()) { for (ModDependencyInfo info : remapList) {
stripNestedJars(info.getRemappedOutput()); stripNestedJars(info.getRemappedOutput());
} }
} }
}
private static void stripNestedJars(File file) { private static void stripNestedJars(File file) {
// Strip out all contained jar info as we dont want loader to try and load the jars contained in dev. // Strip out all contained jar info as we dont want loader to try and load the jars contained in dev.