mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 07:05:40 -04:00
Fix download assets for 1.13+
This commit is contained in:
parent
71fcfa4ed1
commit
5980b5822f
@ -15,6 +15,7 @@ public class JMinecraftVersionList {
|
||||
public static class Version {
|
||||
// Since 1.13, so it's one of ways to check
|
||||
public Arguments arguments;
|
||||
public AssetIndex assetIndex;
|
||||
|
||||
public String assets;
|
||||
public Map<String, MinecraftClientInfo> downloads;
|
||||
@ -46,5 +47,9 @@ public class JMinecraftVersionList {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class AssetIndex {
|
||||
public String id, sha1, url;
|
||||
public long size, totalSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,8 +469,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
||||
statusIsLaunching(true);
|
||||
}
|
||||
|
||||
private int maxSubProgress = 1;
|
||||
private int valSubProgress = 1;
|
||||
private JMinecraftVersionList.Version verInfo;
|
||||
@Override
|
||||
protected Throwable doInBackground(final String[] p1) {
|
||||
Throwable throwable = null;
|
||||
@ -479,8 +478,6 @@ public class MCLauncherActivity extends AppCompatActivity
|
||||
|
||||
//Downloading libraries
|
||||
String inputPath = Tools.versnDir + downVName + ".jar";
|
||||
|
||||
JMinecraftVersionList.Version verInfo;
|
||||
|
||||
try {
|
||||
//com.pojavdx.dx.mod.Main.debug = true;
|
||||
@ -593,6 +590,8 @@ public class MCLauncherActivity extends AppCompatActivity
|
||||
try {
|
||||
downloadAssets(verInfo.assets, new File(Tools.ASSETS_PATH));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
// Ignore it
|
||||
launchWithError = false;
|
||||
} finally {
|
||||
@ -691,12 +690,13 @@ public class MCLauncherActivity extends AppCompatActivity
|
||||
public static final String MINECRAFT_RES = "http://resources.download.minecraft.net/";
|
||||
|
||||
public JAssets downloadIndex(String versionName, File output) throws Exception {
|
||||
String versionJson = DownloadUtils.downloadString("http://s3.amazonaws.com/Minecraft.Download/indexes/" + versionName + ".json");
|
||||
String versionJson = DownloadUtils.downloadString(verInfo.assetIndex != null ? verInfo.assetIndex.url : "http://s3.amazonaws.com/Minecraft.Download/indexes/" + versionName + ".json");
|
||||
JAssets version = gsonss.fromJson(versionJson, JAssets.class);
|
||||
output.getParentFile().mkdirs();
|
||||
Tools.write(output.getAbsolutePath(), versionJson.getBytes(Charset.forName("UTF-8")));
|
||||
return version;
|
||||
}
|
||||
|
||||
public void downloadAsset(JAssetInfo asset, File objectsDir) throws IOException, Throwable {
|
||||
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash;
|
||||
File outFile = new File(objectsDir, assetPath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user