mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-19 01:27:18 -04:00
[Bug fix] Offline play causes error
This commit is contained in:
parent
d41bcb6561
commit
8f5608975e
@ -123,7 +123,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
Toast.makeText(this, getStr(R.string.toast_login_error, e.getMessage()), Toast.LENGTH_LONG).show();
|
Toast.makeText(this, getStr(R.string.toast_login_error, e.getMessage()), Toast.LENGTH_LONG).show();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
File logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
|
File logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
|
||||||
if (logFile.exists() && logFile.length() < 20480) {
|
if (logFile.exists() && logFile.length() < 20480) {
|
||||||
String errMsg = "Error occurred during initialization of ";
|
String errMsg = "Error occurred during initialization of ";
|
||||||
@ -143,7 +143,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
th.printStackTrace();
|
th.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//showProfileInfo();
|
//showProfileInfo();
|
||||||
|
|
||||||
List<String> versions = new ArrayList<String>();
|
List<String> versions = new ArrayList<String>();
|
||||||
@ -448,12 +448,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
// Catching touch exception
|
// Catching touch exception
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
try {
|
return super.onTouchEvent(event);
|
||||||
return super.onTouchEvent(event);
|
|
||||||
} catch (Throwable th) {
|
|
||||||
Tools.showError(this, th);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GameRunnerTask mTask;
|
private GameRunnerTask mTask;
|
||||||
@ -708,15 +703,15 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
mTask = null;
|
mTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Gson gsonss = gson;
|
|
||||||
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 Throwable {
|
||||||
String versionJson = DownloadUtils.downloadString(verInfo.assetIndex != null ? verInfo.assetIndex.url : "http://s3.amazonaws.com/Minecraft.Download/indexes/" + versionName + ".json");
|
if (!output.exists()) {
|
||||||
JAssets version = gsonss.fromJson(versionJson, JAssets.class);
|
output.getParentFile().mkdirs();
|
||||||
output.getParentFile().mkdirs();
|
DownloadUtils.downloadFile(verInfo.assetIndex != null ? verInfo.assetIndex.url : "http://s3.amazonaws.com/Minecraft.Download/indexes/" + versionName + ".json", output);
|
||||||
Tools.write(output.getAbsolutePath(), versionJson.getBytes(Charset.forName("UTF-8")));
|
}
|
||||||
return version;
|
|
||||||
|
return gson.fromJson(Tools.read(output.getAbsolutePath()), JAssets.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadAsset(JAssetInfo asset, File objectsDir) throws IOException, Throwable {
|
public void downloadAsset(JAssetInfo asset, File objectsDir) throws IOException, Throwable {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user