mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-19 09:39:25 -04:00
Some fixes
This commit is contained in:
parent
73056cae19
commit
33129ad947
@ -518,13 +518,14 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
DependentLibrary[] libList = verInfo.libraries;
|
DependentLibrary[] libList = verInfo.libraries;
|
||||||
setMax(libList.length * 2 + 5);
|
setMax(libList.length * 2 + 5);
|
||||||
|
|
||||||
|
File outLib;
|
||||||
String libPathURL;
|
String libPathURL;
|
||||||
|
|
||||||
for (final DependentLibrary libItem: libList) {
|
for (final DependentLibrary libItem: libList) {
|
||||||
|
|
||||||
if (// libItem.name.startsWith("com.google.code.gson:gson") ||
|
if (// libItem.name.startsWith("com.google.code.gson:gson") ||
|
||||||
// libItem.name.startsWith("com.mojang:realms") ||
|
// libItem.name.startsWith("com.mojang:realms") ||
|
||||||
// libItem.name.startsWith("net.java.jinput") ||
|
libItem.name.startsWith("net.java.jinput") ||
|
||||||
// libItem.name.startsWith("net.minecraft.launchwrapper") ||
|
// libItem.name.startsWith("net.minecraft.launchwrapper") ||
|
||||||
libItem.name.startsWith("optifine:launchwrapper-of") ||
|
libItem.name.startsWith("optifine:launchwrapper-of") ||
|
||||||
// libItem.name.startsWith("org.lwjgl.lwjgl:lwjgl") ||
|
// libItem.name.startsWith("org.lwjgl.lwjgl:lwjgl") ||
|
||||||
@ -534,37 +535,48 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
publishProgress("1", "Ignored " + libItem.name);
|
publishProgress("1", "Ignored " + libItem.name);
|
||||||
//Thread.sleep(100);
|
//Thread.sleep(100);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
String[] libInfo = libItem.name.split(":");
|
String[] libInfo = libItem.name.split(":");
|
||||||
String libArtifact = Tools.artifactToPath(libInfo[0], libInfo[1], libInfo[2]);
|
String libArtifact = Tools.artifactToPath(libInfo[0], libInfo[1], libInfo[2]);
|
||||||
boolean skipIfFailed = false;
|
outLib = new File(Tools.libraries + "/" + libArtifact);
|
||||||
|
outLib.getParentFile().mkdirs();
|
||||||
|
|
||||||
if (libItem.downloads == null) {
|
if (!outLib.exists()) {
|
||||||
MinecraftLibraryArtifact artifact = new MinecraftLibraryArtifact();
|
publishProgress("1", getStr(R.string.mcl_launch_download_lib, libItem.name));
|
||||||
artifact.url = "https://libraries.minecraft.net/" + libArtifact;
|
|
||||||
libItem.downloads = new DependentLibrary.LibraryDownloads(artifact);
|
|
||||||
|
|
||||||
skipIfFailed = true;
|
boolean skipIfFailed = false;
|
||||||
}
|
|
||||||
try {
|
if (libItem.downloads == null || libItem.downloads.artifact == null) {
|
||||||
libPathURL = libItem.downloads.artifact.url;
|
MinecraftLibraryArtifact artifact = new MinecraftLibraryArtifact();
|
||||||
} catch (Throwable th) {
|
artifact.url = "https://libraries.minecraft.net/" + libArtifact;
|
||||||
if (!skipIfFailed) {
|
libItem.downloads = new DependentLibrary.LibraryDownloads(artifact);
|
||||||
throw th;
|
|
||||||
} else {
|
skipIfFailed = true;
|
||||||
th.printStackTrace();
|
}
|
||||||
|
try {
|
||||||
|
libPathURL = libItem.downloads.artifact.url;
|
||||||
|
Tools.downloadFile(
|
||||||
|
libPathURL,
|
||||||
|
outLib.getAbsolutePath(),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} catch (Throwable th) {
|
||||||
|
if (!skipIfFailed) {
|
||||||
|
throw th;
|
||||||
|
} else {
|
||||||
|
th.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishProgress("5", getStr(R.string.mcl_launch_download_client, p1[0]));
|
publishProgress("5", getStr(R.string.mcl_launch_download_client, p1[0]));
|
||||||
if (!new File(inputPath).exists()) {
|
Tools.downloadFile(
|
||||||
Tools.downloadFile(
|
verInfo.downloads.values().toArray(new MinecraftClientInfo[0])[0].url,
|
||||||
verInfo.downloads.values().toArray(new MinecraftClientInfo[0])[0].url,
|
inputPath,
|
||||||
inputPath,
|
true
|
||||||
true
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
launchWithError = true;
|
launchWithError = true;
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -27,7 +27,7 @@ public final class Tools
|
|||||||
public static boolean enableDevFeatures = BuildConfig.DEBUG;
|
public static boolean enableDevFeatures = BuildConfig.DEBUG;
|
||||||
|
|
||||||
public static String APP_NAME = "null";
|
public static String APP_NAME = "null";
|
||||||
public static String MAIN_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/minecraft";
|
public static String MAIN_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/.minecraft";
|
||||||
public static String ASSETS_PATH = MAIN_PATH + "/assets";
|
public static String ASSETS_PATH = MAIN_PATH + "/assets";
|
||||||
public static String CTRLMAP_PATH = MAIN_PATH + "/controlmap";
|
public static String CTRLMAP_PATH = MAIN_PATH + "/controlmap";
|
||||||
public static String CTRLDEF_FILE = MAIN_PATH + "/controlmap/default.json";
|
public static String CTRLDEF_FILE = MAIN_PATH + "/controlmap/default.json";
|
||||||
@ -489,11 +489,9 @@ public final class Tools
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void downloadFile(String urlInput, String nameOutput, boolean requireNonExist) throws Throwable
|
public static void downloadFile(String urlInput, String nameOutput, boolean requireNonExist) throws Throwable {
|
||||||
{
|
|
||||||
File fileDDD = new File(nameOutput);
|
File fileDDD = new File(nameOutput);
|
||||||
if(requireNonExist && !fileDDD.exists())
|
if(requireNonExist && !fileDDD.exists()) {
|
||||||
{
|
|
||||||
DownloadUtils.downloadFile(urlInput, fileDDD);
|
DownloadUtils.downloadFile(urlInput, fileDDD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user