From 2cad6f33f5439d53c3fb18d2a31e4e8da97932c4 Mon Sep 17 00:00:00 2001 From: Glavo Date: Tue, 23 Jan 2024 11:22:54 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20#2552:=20=E5=AF=B9=E4=BA=8E=20Minecraft?= =?UTF-8?q?=201.19+=20=E4=B8=8D=E5=BA=94=E7=89=B9=E6=AE=8A=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=B8=AD=E6=96=87=E8=B7=AF=E5=BE=84=20(#2670)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jackhuang/hmcl/launch/DefaultLauncher.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java index 29fea8b83..12ac969f9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -222,12 +222,15 @@ public class DefaultLauncher extends Launcher { configuration.put("${game_assets}", gameAssets.toAbsolutePath().toString()); configuration.put("${assets_root}", gameAssets.toAbsolutePath().toString()); + Optional gameVersion = repository.getGameVersion(version); + // lwjgl assumes path to native libraries encoded by ASCII. // Here is a workaround for this issue: https://github.com/HMCL-dev/HMCL/issues/1141. String nativeFolderPath = nativeFolder.getAbsolutePath(); Path tempNativeFolder = null; if ((OperatingSystem.CURRENT_OS == OperatingSystem.LINUX || OperatingSystem.CURRENT_OS == OperatingSystem.OSX) - && !StringUtils.isASCII(nativeFolderPath)) { + && !StringUtils.isASCII(nativeFolderPath) + && gameVersion.isPresent() && VersionNumber.VERSION_COMPARATOR.compare(gameVersion.get(), "1.19") < 0) { tempNativeFolder = Paths.get("/", "tmp", "hmcl-natives-" + UUID.randomUUID()); nativeFolderPath = tempNativeFolder + File.pathSeparator + nativeFolderPath; } @@ -256,7 +259,7 @@ public class DefaultLauncher extends Launcher { if (StringUtils.isNotBlank(options.getServerIp())) { String[] args = options.getServerIp().split(":"); - if (VersionNumber.VERSION_COMPARATOR.compare(repository.getGameVersion(version).orElse("0.0"), "1.20") < 0) { + if (VersionNumber.VERSION_COMPARATOR.compare(gameVersion.orElse("0.0"), "1.20") < 0) { res.add("--server"); res.add(args[0]); res.add("--port");