mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 21:40:15 -07:00
Auto-download inherited version if it does not exist
This commit is contained in:
parent
91815f486e
commit
d7acd362e2
3 changed files with 17 additions and 6 deletions
|
|
@ -534,7 +534,7 @@ public final class Tools
|
|||
return libDir.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public static JMinecraftVersionList.Version getVersionInfo(String versionName) {
|
||||
public static JMinecraftVersionList.Version getVersionInfo(BaseLauncherActivity bla, String versionName) {
|
||||
try {
|
||||
JMinecraftVersionList.Version customVer = Tools.GLOBAL_GSON.fromJson(read(DIR_HOME_VERSION + "/" + versionName + "/" + versionName + ".json"), JMinecraftVersionList.Version.class);
|
||||
for (DependentLibrary lib : customVer.libraries) {
|
||||
|
|
@ -545,9 +545,20 @@ public final class Tools
|
|||
if (customVer.inheritsFrom == null || customVer.inheritsFrom.equals(customVer.id)) {
|
||||
return customVer;
|
||||
} else {
|
||||
JMinecraftVersionList.Version inheritsVer = Tools.GLOBAL_GSON.fromJson(read(DIR_HOME_VERSION + "/" + customVer.inheritsFrom + "/" + customVer.inheritsFrom + ".json"), JMinecraftVersionList.Version.class);
|
||||
JMinecraftVersionList.Version inheritsVer = null;
|
||||
if(bla != null) if (bla.mVersionList != null) {
|
||||
for (JMinecraftVersionList.Version valueVer : bla.mVersionList.versions) {
|
||||
if (valueVer.id.equals(customVer.inheritsFrom) && (!new File(DIR_HOME_VERSION + "/" + customVer.inheritsFrom + "/" + customVer.inheritsFrom + ".json").exists()) && (valueVer.url != null)) {
|
||||
Tools.downloadFile(valueVer.url,DIR_HOME_VERSION + "/" + customVer.inheritsFrom + "/" + customVer.inheritsFrom + ".json");
|
||||
}
|
||||
}
|
||||
}//If it won't download, just search for it
|
||||
try{
|
||||
inheritsVer = Tools.GLOBAL_GSON.fromJson(read(DIR_HOME_VERSION + "/" + customVer.inheritsFrom + "/" + customVer.inheritsFrom + ".json"), JMinecraftVersionList.Version.class);
|
||||
}catch(IOException e) {
|
||||
throw new RuntimeException("Can't find the source version for "+ versionName +" (req version="+customVer.inheritsFrom+")");
|
||||
}
|
||||
inheritsVer.inheritsFrom = inheritsVer.id;
|
||||
|
||||
insertSafety(inheritsVer, customVer,
|
||||
"assetIndex", "assets", "id",
|
||||
"mainClass", "minecraftArguments",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue