From 5a876df9c29c62bcfcd884153b16d635b3ef78ef Mon Sep 17 00:00:00 2001 From: SolDev69 <40839581+SolDev69@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:48:05 +0000 Subject: [PATCH] changes fix some java 21 stuff --- .../main/java/net/kdt/pojavlaunch/JRE21Util.java | 16 ++++++++-------- .../pojavlaunch/tasks/MinecraftDownloader.java | 4 ++-- .../src/main/res/values/strings.xml | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java b/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java index c88e497f07..d203244f4c 100644 --- a/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java +++ b/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java @@ -16,21 +16,21 @@ public class JRE21Util { public static final String NEW_JRE_NAME = "Internal-21"; public static boolean checkInternalNewJre(AssetManager assetManager) { - String launcher_jre17_version; - String installed_jre17_version = MultiRTUtils.__internal__readBinpackVersion(NEW_JRE_NAME); + String launcher_jre21_version; + String installed_jre21_version = MultiRTUtils.__internal__readBinpackVersion(NEW_JRE_NAME); try { - launcher_jre17_version = Tools.read(assetManager.open("components/jre-new/version")); + launcher_jre21_version = Tools.read(assetManager.open("components/jre-new/version")); }catch (IOException exc) { //we don't have a runtime included! - return installed_jre17_version != null; //if we have one installed -> return true -> proceed (no updates but the current one should be functional) + return installed_jre21_version != null; //if we have one installed -> return true -> proceed (no updates but the current one should be functional) //if we don't -> return false -> Cannot find compatible Java runtime } - if(!launcher_jre17_version.equals(installed_jre17_version)) // this implicitly checks for null, so it will unpack the runtime even if we don't have one installed - return unpackJre17(assetManager, launcher_jre17_version); + if(!launcher_jre21_version.equals(installed_jre21_version)) // this implicitly checks for null, so it will unpack the runtime even if we don't have one installed + return unpackJre21(assetManager, launcher_jre21_version); else return true; } - private static boolean unpackJre17(AssetManager assetManager, String rt_version) { + private static boolean unpackJre21(AssetManager assetManager, String rt_version) { try { MultiRTUtils.installRuntimeNamedBinpack( assetManager.open("components/jre-new/universal.tar.xz"), @@ -73,7 +73,7 @@ public static boolean installNewJreIfNeeded(Activity activity, JMinecraftVersion minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + appropriateRuntime; LauncherProfiles.load(); } else { - if (versionInfo.javaVersion.majorVersion <= 17) { // there's a chance we have an internal one for this case + if (versionInfo.javaVersion.majorVersion <= 21) { // there's a chance we have an internal one for this case if (!JRE21Util.checkInternalNewJre(activity.getAssets())){ showRuntimeFail(activity, versionInfo); return false; diff --git a/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java b/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java index 0ad0900ea4..ce96df49d3 100644 --- a/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java +++ b/app_solcraftlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java @@ -88,7 +88,7 @@ private void downloadGame(Activity activity, JMinecraftVersionList.Version verIn mDownloaderThreadException = new AtomicReference<>(null); if(!downloadAndProcessMetadata(activity, verInfo, versionName)) { - throw new RuntimeException(activity.getString(R.string.exception_failed_to_unpack_jre17)); + throw new RuntimeException(activity.getString(R.string.exception_failed_to_unpack_jre21)); } ArrayBlockingQueue taskQueue = @@ -190,7 +190,7 @@ private MinecraftClientInfo getClientInfo(JMinecraftVersionList.Version verInfo) * @param activity Activity, used for automatic installation of JRE 17 if needed * @param verInfo The JMinecraftVersionList.Version from the version list, if available * @param versionName The version ID (necessary) - * @return false if JRE17 installation failed, true otherwise + * @return false if JRE21 installation failed, true otherwise * @throws IOException if the download of any of the metadata files fails */ private boolean downloadAndProcessMetadata(Activity activity, JMinecraftVersionList.Version verInfo, String versionName) throws IOException, MirrorTamperedException { diff --git a/app_solcraftlauncher/src/main/res/values/strings.xml b/app_solcraftlauncher/src/main/res/values/strings.xml index 7114a59e1e..e66cec55a5 100644 --- a/app_solcraftlauncher/src/main/res/values/strings.xml +++ b/app_solcraftlauncher/src/main/res/values/strings.xml @@ -367,7 +367,7 @@ Click to re-request the notification permission, required for game/modpack background downloads to work properly. Allow V-Sync with Zink Allows the launcher to use internal system APIs to enable V-Sync for Zink. Turn this off if your launcher suddenly crashes with Zink after a system update. - Failed to install JRE 17 + Failed to install JRE 17 Reading game metadata… Downloading game metadata (%s) Downloading game files… (%d/%d, %.2f MB)