mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 07:39:00 -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 {
|
public static class Version {
|
||||||
// Since 1.13, so it's one of ways to check
|
// Since 1.13, so it's one of ways to check
|
||||||
public Arguments arguments;
|
public Arguments arguments;
|
||||||
|
public AssetIndex assetIndex;
|
||||||
|
|
||||||
public String assets;
|
public String assets;
|
||||||
public Map<String, MinecraftClientInfo> downloads;
|
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);
|
statusIsLaunching(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int maxSubProgress = 1;
|
private JMinecraftVersionList.Version verInfo;
|
||||||
private int valSubProgress = 1;
|
|
||||||
@Override
|
@Override
|
||||||
protected Throwable doInBackground(final String[] p1) {
|
protected Throwable doInBackground(final String[] p1) {
|
||||||
Throwable throwable = null;
|
Throwable throwable = null;
|
||||||
@ -479,8 +478,6 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
|
|
||||||
//Downloading libraries
|
//Downloading libraries
|
||||||
String inputPath = Tools.versnDir + downVName + ".jar";
|
String inputPath = Tools.versnDir + downVName + ".jar";
|
||||||
|
|
||||||
JMinecraftVersionList.Version verInfo;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//com.pojavdx.dx.mod.Main.debug = true;
|
//com.pojavdx.dx.mod.Main.debug = true;
|
||||||
@ -593,6 +590,8 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
try {
|
try {
|
||||||
downloadAssets(verInfo.assets, new File(Tools.ASSETS_PATH));
|
downloadAssets(verInfo.assets, new File(Tools.ASSETS_PATH));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
// Ignore it
|
// Ignore it
|
||||||
launchWithError = false;
|
launchWithError = false;
|
||||||
} finally {
|
} finally {
|
||||||
@ -691,12 +690,13 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
public static final String MINECRAFT_RES = "http://resources.download.minecraft.net/";
|
public static final String MINECRAFT_RES = "http://resources.download.minecraft.net/";
|
||||||
|
|
||||||
public JAssets downloadIndex(String versionName, File output) throws Exception {
|
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);
|
JAssets version = gsonss.fromJson(versionJson, JAssets.class);
|
||||||
output.getParentFile().mkdirs();
|
output.getParentFile().mkdirs();
|
||||||
Tools.write(output.getAbsolutePath(), versionJson.getBytes(Charset.forName("UTF-8")));
|
Tools.write(output.getAbsolutePath(), versionJson.getBytes(Charset.forName("UTF-8")));
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadAsset(JAssetInfo asset, File objectsDir) throws IOException, Throwable {
|
public void downloadAsset(JAssetInfo asset, File objectsDir) throws IOException, Throwable {
|
||||||
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash;
|
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash;
|
||||||
File outFile = new File(objectsDir, assetPath);
|
File outFile = new File(objectsDir, assetPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user