Fix: Forge 1.20 crashes (wrong artifact path)

Now use json-provided artifact path instead of generating one
This commit is contained in:
khanhduytran0 2023-06-19 17:25:46 +07:00
parent 4ce4721920
commit dab2da2fc4
2 changed files with 2 additions and 13 deletions

View file

@ -384,17 +384,6 @@ public final class Tools {
return strList.toArray(new String[0]);
}
public static String artifactToPath(String name) {
int idx = name.indexOf(":");
assert idx != -1;
int idx2 = name.indexOf(":", idx+1);
assert idx2 != -1;
String group = name.substring(0, idx);
String artifact = name.substring(idx+1, idx2);
String version = name.substring(idx2+1).replace(':','-');
return group.replaceAll("\\.", "/") + "/" + artifact + "/" + version + "/" + artifact + "-" + version + ".jar";
}
public static String getPatchedFile(String version) {
return DIR_HOME_VERSION + "/" + version + "/" + version + ".jar";
}
@ -617,7 +606,7 @@ public final class Tools {
List<String> libDir = new ArrayList<>();
for (DependentLibrary libItem: info.libraries) {
if(!checkRules(libItem.rules)) continue;
libDir.add(Tools.DIR_HOME_LIBRARY + "/" + Tools.artifactToPath(libItem.name));
libDir.add(Tools.DIR_HOME_LIBRARY + "/" + libItem.downloads.artifact.path;
}
return libDir.toArray(new String[0]);
}

View file

@ -141,7 +141,7 @@ public class AsyncMinecraftDownloader {
continue;
}
String libArtifact = Tools.artifactToPath(libItem.name);
String libArtifact = libItem.downloads.artifact.path;
outLib = new File(Tools.DIR_HOME_LIBRARY + "/" + libArtifact);
outLib.getParentFile().mkdirs();