Compare commits

...
54 Commits
Author SHA1 Message Date
huanghongxun 19b6633f4a fix: checkstyle. 2022-08-21 21:29:09 +08:00
huanghongxun 2ad3e7a291 fix(account): Authlib-Injector server may be unknown when in CreateAcountPane tab mode. 2022-08-21 21:26:20 +08:00
huanghongxun 1fa63a528d fix(download): installer items overflow. Closes #1645. 2022-08-21 21:20:10 +08:00
Glavo b80c787b60 为非 x86 平台提供开箱即用的启动支持 (#1610)
* Replace native libraries on non-x86 platforms

* Add support for Linux ARM

* Relax the constraint 'JavaVersionConstraint.VANILLA_X86'

* Fix several hints

* Add OpenGL software renderer option

* Add support for OpenGL software renderer on windows

* Add __GLX_VENDOR_LIBRARY_NAME on Linux

* Catch GLFW error 65543

* Allow users to disable auto completion of native libraries

* fix NPE when violated mandatory constraint

* Add support for Minecraft 1.13

* Add support for Minecraft 1.6~1.12

* Add base support for linux-loongarch64

* Improve warnings on Loongson platform

* Add linux launcher script

* fix typo

* Add support for loongarch64 (old world)
2022-08-21 19:00:05 +08:00
Lonelyxiya c8652012c5 I18N_zh.properties (#1611)
修訂了一些台灣詞彙。來自https://discord.com/channels/815819580840607807/815860830058840064/1003644502478704671
RPMTW的翻譯討論頻道
2022-08-21 18:27:27 +08:00
Glavo e70b43be26 Temporarily rollback HMCLauncher.exe (#1625)
close #1583, close #1577
2022-08-21 18:26:54 +08:00
K1t3AB 2d182807b2 feat(README_cn.md): Added Chinese translation for README.md (#1637)
* feat(README_cn.md): Added Chinese translation for README.md

* edit(README.md): Improved formats for README.md

* fix(README): Roll back to Commit ID to pin lines

* edit(README): Let languages switchers "more like buttons"

* fix(README): Fix errors caused by misunderstanding

* edit(README): Added 8 spaces
2022-08-21 18:26:42 +08:00
huanghongxun 675af3a5aa feat(download): quilt installation. 2022-08-21 18:20:11 +08:00
huanghongxun 4ba4c3e749 feat(quilt): WIP: partially implements quilt installation. 2022-08-20 15:52:22 +08:00
huanghongxun 11e2277c9e feat(account): show little-skin login method by default. Closes #1622. 2022-08-20 14:58:38 +08:00
Yuhui Huang 66642fe621 fix(i18n): line ending of Spanish lang file. 2022-08-08 17:21:19 +08:00
Nekrodamus 3189a22f26 Update I18N_es.properties (#1614)
* Update I18N_es.properties

Updated the Spanish language file to the latest Beta version, using as template the I18N.properties file.

[Completed]

* Update I18N_es.properties

Little fix

* Update I18N_es.properties

More fixes.

* Update I18N_es.properties

Corrected the label for modpacks "Investigaciones" to "Quests".

* Update I18N_es.properties

More fixes

* Update I18N_es.properties

Final fixes

* Update I18N_es.properties

Fixed bug that caused a string not to be translated.

* Update I18N_es.properties

Little fix

* Update I18N_es.properties

Little fix

* Update I18N_es.properties

Little fixes

* Update I18N_es.properties

Little fix

* Update I18N_es.properties

Improved the context of some sentences

* Update I18N_es.properties

Reverted fix

* Update I18N_es.properties

Changes in capitalization

* Update I18N_es.properties

Some fixes...

* Update I18N_es.properties

More corrections...
2022-08-08 17:19:59 +08:00
Tungstend 366e359d83 修复litemod信息获取失败 (#1545)
* 修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能

* Revert "修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能"

This reverts commit 1d29c69d92.

* 修复CF源获取模组版本列表不全

* Modrinth源获取类别列表,搜索时增加类别选项

* Update ModrinthRemoteModRepository.java

* Update ModrinthRemoteModRepository.java

* 修复cf源获取前置模组失败

* Revert "Update ModrinthRemoteModRepository.java"

This reverts commit 40b7c1d59d.

* Revert "Revert "Update ModrinthRemoteModRepository.java""

This reverts commit 2027c9ef4c.

* Revert "修复cf源获取前置模组失败"

This reverts commit 4404daf0ea.

* fix conflict

* 修复cf源无法获取前置模组

* fix check style

* Update LiteModMetadata.java
2022-08-08 16:58:55 +08:00
ZekerZhayard f7d8a473aa Fix NoSuchMethodError when compiling with Java 9+ (#1585) 2022-08-08 16:58:14 +08:00
zkitefly 8276bf5d8c 在 README 中添加 Fabric (#1587)
* Create  获得加入Cato社区网络身份凭证的方法.txt

* Delete 获得加入Cato社区网络身份凭证的方法.txt

* Update CreateMultiplayerRoomDialog.java

* Update CreateMultiplayerRoomDialog.java

* Update MultiplayerPageSkin.java

* Update README.md
2022-08-08 16:57:47 +08:00
zkitefly 371150dfa8 添加提示 (#1597)
* Create  获得加入Cato社区网络身份凭证的方法.txt

* Delete 获得加入Cato社区网络身份凭证的方法.txt

* Update CreateMultiplayerRoomDialog.java

* Update CreateMultiplayerRoomDialog.java

* Update MultiplayerPageSkin.java

* text

* text

* now

* now

* 优化下简体,繁体,和英文

* 再优化了下

* fix

* fix

* text

* text

* now
2022-08-08 16:57:31 +08:00
Glavo 38d71fd6bb Add world info page (#1620) 2022-08-08 16:56:03 +08:00
king tsaltedfishandYuhui Huang c627ca96c9 Rewrite badges (#1612)
Co-authored-by: Yuhui Huang <[email protected]>
2022-08-08 16:52:58 +08:00
Rovniced 09167bb302 修复curseforge文件名存在中文下载失败 (#1578)
* Update RemoteMod.java

* Update RemoteMod.java

* Update RemoteMod.java
2022-08-08 16:52:02 +08:00
zkitefly a3c24b1b02 因 开黑啦 改名成 KOOK,所以改名 (#1600)
* 修改加入链接的前缀“kaihei.co”->“kook.top”

* 因开黑啦改名成KOOK,所以改名。邀请链接也做相应调整。

* Update bug-report.yml

* Update bug-report.yml

顺便无伤大雅的修改了下这里

* Update config.yml

修改了下这里的英文空格隔离

* Add files via upload

上传新logo

* Delete kaiheila.jpeg

删除旧logo

* Update I18N.properties

修改回原来样式

* Update I18N_zh.properties

修改開黑啦为KOOK
2022-08-08 16:51:38 +08:00
Glavo 9f4a3cf8a8 Disable Microsoft login when auth id is empty 2022-06-19 18:58:38 +08:00
xmdhs 702d27393e replace piston-data.mojang.com 2022-06-17 11:16:33 +08:00
xmdhs 698d3a311d replace piston-meta.mojang.com 2022-06-17 11:16:33 +08:00
Glavo c92f8e3b51 Complete optifine that is not installed automatically 2022-06-16 20:35:14 +08:00
Glavo 7c502ecd01 fix #1311: fix auto complete OptiFine 2022-06-16 20:35:14 +08:00
Glavo a237a31d23 Output the URL in the log when the file is not found 2022-06-16 20:35:14 +08:00
Glavo 5f4fc77258 Use language-independent links 2022-06-15 11:42:16 +08:00
ZekerZhayard 8bd4df68f5 Fix #1543 2022-06-14 12:49:56 +08:00
Glavo 29cff02f3c Update JavaVersionConstraint 2022-06-13 23:30:41 +08:00
Glavo d1bc41e1f1 Detect loongarch 2022-06-13 23:30:41 +08:00
huanghongxun 2fd1bf4c29 fix(i18n): incorrect translation change. 2022-06-05 14:11:04 +08:00
huanghongxun edd89fb040 fix: test. 2022-06-03 23:59:35 +08:00
ByacryaandYuhui Huang 08d6b58c8c feat(i18n): greatly improve en_US translation (#1522)
It seems that the current translation was largely done by Google Translation, so I did some work to improve it.

Some translations can definitely be improved, but I don't have much time at the moment so I will leave it for now.

Co-authored-by: Yuhui Huang <[email protected]>
2022-06-03 23:27:27 +08:00
huanghongxun e3fc9f5116 feat: auto find java by default. Closes #1511. 2022-06-03 23:19:47 +08:00
huanghongxun 6dcd808cc8 fix(crash): suggest jdk corruption. Closes #1509. 2022-06-03 23:17:00 +08:00
huanghongxun df6230fc01 fix(install): date deserialization. Closes #1512. 2022-06-03 23:13:40 +08:00
huanghongxun 9f502ae6ae fix(modpack): missing .mrpack extension. Closes #1531. 2022-06-03 22:53:23 +08:00
huanghongxun 2a979d2b15 fix(download): incorrect mcmod url for modpacks. Closes #1525. 2022-06-03 22:47:03 +08:00
huanghongxun ae484e3b67 fix(download): inappropriate translation for "Vanilla+" 2022-06-03 22:47:02 +08:00
Byacrya 7206832edb feat(i18n): correct zh_CN translation
Vanilla+ should be translated to '原版增强' instead of '香草+'.
2022-06-03 21:08:45 +08:00
zkitefly 288b32ed79 I18N.properties (#1526)
* Create  获得加入Cato社区网络身份凭证的方法.txt

* Delete 获得加入Cato社区网络身份凭证的方法.txt

* Update CreateMultiplayerRoomDialog.java

* Update CreateMultiplayerRoomDialog.java

* Update MultiplayerPageSkin.java

* Update I18N_zh_CN.properties

* Update I18N_zh_CN.properties

* Update I18N_zh.properties

* Update I18N_ru.properties

* Update I18N_ja.properties

* Update I18N_es.properties

* Update I18N.properties
2022-06-03 17:01:37 +08:00
zkitefly 53bc3b354f 修改微软账户上传皮肤链接 (#1521)
* Create  获得加入Cato社区网络身份凭证的方法.txt

* Delete 获得加入Cato社区网络身份凭证的方法.txt

* Update CreateMultiplayerRoomDialog.java

* Update CreateMultiplayerRoomDialog.java

* Update MultiplayerPageSkin.java

* Update AccountListItem.java
2022-06-02 20:53:39 +08:00
Tungstend 30565c2b50 修复cf源无法获取前置模组 (#1520)
* 修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能

* Revert "修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能"

This reverts commit 1d29c69d92.

* 修复CF源获取模组版本列表不全

* Modrinth源获取类别列表,搜索时增加类别选项

* Update ModrinthRemoteModRepository.java

* Update ModrinthRemoteModRepository.java

* 修复cf源获取前置模组失败

* Revert "Update ModrinthRemoteModRepository.java"

This reverts commit 40b7c1d59d.

* Revert "Revert "Update ModrinthRemoteModRepository.java""

This reverts commit 2027c9ef4c.

* Revert "修复cf源获取前置模组失败"

This reverts commit 4404daf0ea.

* fix conflict

* 修复cf源无法获取前置模组

* fix check style
2022-06-02 14:14:51 +08:00
zkitefly c400c7be9d Account migration link update (#1513)
* Create  获得加入Cato社区网络身份凭证的方法.txt

* Delete 获得加入Cato社区网络身份凭证的方法.txt

* Update CreateMultiplayerRoomDialog.java

* Update CreateMultiplayerRoomDialog.java

* Update MultiplayerPageSkin.java

* Update YggdrasilService.java
2022-06-02 13:04:12 +08:00
zkitefly 7acd9d2491 Update AboutPage.java (#1516)
* Create  获得加入Cato社区网络身份凭证的方法.txt

* Delete 获得加入Cato社区网络身份凭证的方法.txt

* Update CreateMultiplayerRoomDialog.java

* Update CreateMultiplayerRoomDialog.java

* Update MultiplayerPageSkin.java

* Update AboutPage.java
2022-06-02 13:01:30 +08:00
huanghongxun dc26dba1d0 fix(download): category may be null. 2022-05-24 01:17:29 +08:00
huanghongxun 66cbb23a38 fix(java): broken macos java location. 2022-05-24 01:09:10 +08:00
huanghongxun 663fc176d8 feat(java): find java in minecraft runtime directory with any component name. As a new component name "java-runtime-gamma" was added. 2022-05-24 01:02:16 +08:00
Mingye Wang b9ec22677e chore(javaversion): refactor searchPotentialJavaExecutables (#1485)
* chore(javaversion): refactor searchPotentialJavaExecutables

This is a very draft quality PR. I don't even have JDK installed to build it, that's how draft it is.

1. Refactor function to share common steps of the code: system locations, Minecraft launcher runtimes, PATH/HMCL_JRES
2. Modify Minecraft launcher runtimes to include java-runtime-beta

* Update HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/JavaVersion.java

* Make optional happy

* correct stream-of paren; add macOS bundle exploration

* who needs exploreBundle?

* fix a stupid typo; add debugging tools. It works!
2022-05-23 23:17:32 +08:00
Tungstend 7d55c7f37f Modrinth获取类别列表,搜索时增加类别筛选 (#1501)
* 修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能

* Revert "修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能"

This reverts commit 1d29c69d92.

* 修复CF源获取模组版本列表不全

* Modrinth源获取类别列表,搜索时增加类别选项

* Update ModrinthRemoteModRepository.java

* Update ModrinthRemoteModRepository.java
2022-05-23 23:03:33 +08:00
huanghongxun f12882a389 fix(download): should update category list after download soruce changed. 2022-05-23 22:27:30 +08:00
huanghongxun 8cfde9d5c6 feat(download): modrinth moddpack category translations. 2022-05-23 21:57:08 +08:00
huanghongxun 10180a74b6 fix: style. 2022-05-22 15:43:08 +08:00
huanghongxun abd30c397d fix(ui): support reveal file in finder, or just open parent directory in Linux. Closes #1458. 2022-05-22 15:40:47 +08:00
90 changed files with 5577 additions and 1397 deletions

No files matched your search

+5 -5
View File
@@ -1,6 +1,6 @@
name: Bug Feedback
description:
反馈一个 Bug。为了提高反馈效率,请优先在开黑啦或者或 Discord 频道中反馈。若确认是 HMCL 问题,请发布 issue。
反馈一个 Bug。为了提高反馈效率,请优先在 KOOK 或者或 Discord 频道中反馈。若确认是 HMCL 问题,请发布 issue。
body:
- type: markdown
attributes:
@@ -8,16 +8,16 @@ body:
提交前请确保你的启动器版本是**最新的开发版**,可以在启动器设置中更换更新通道至开发版获取更新。
我们发现,对于不经常检查邮箱的人来说,GitHub Issues 的反馈效率太低,时隔几个小时甚至一天的情况很多。
为了改善反馈效率,并将积极为 HMCL 提供问题反馈和建议的人聚集起来,我们希望在这里反馈的人可以在 [开黑啦频道](https://kaihei.co/Kx7n3t)
为了改善反馈效率,并将积极为 HMCL 提供问题反馈和建议的人聚集起来,我们希望在这里反馈的人可以在 [KOOK 频道](https://kook.top/Kx7n3t)
或 [Discord 频道](https://discord.gg/jVvC7HfM6U)中反馈信息,**而不在 GitHub Issues 中反馈问题**。
如果你希望在 QQ 群中反馈问题,请[赞助 HMCL](https://afdian.net/@huanghongxun) 后申请加入群聊,也请将下面的信息表填好直接发在群中,加快我们的沟通速度。
如果你希望在 QQ 群中反馈问题,请[赞助 HMCL](https://hmcl.huangyuhui.net/api/redirect/sponsor) 后申请加入群聊,也请将下面的信息表填好直接发在群中,加快我们的沟通速度。
- type: input
id: hmcl-version
attributes:
label: 启动器版本 Launcher Version
description: 请输入您所使用的的 HMCL 启动器版本。 Please enter the HMCL launcher version you are using.
placeholder: e.g. 3.5.2.218
placeholder: e.g. 3.5.3.211
validations:
required: true
- type: input
@@ -39,7 +39,7 @@ body:
attributes:
label: 游戏版本 Game Version
description: 如果您是在启动通过 HMCL 启动器自动下载的游戏时遇到了问题,请输入您所启动的游戏版本。If you are having trouble launching a game that was automatically downloaded through the HMCL launcher, please enter the version of the game you are launching.
placeholder: e.g. 1.17.1
placeholder: e.g. 1.19
- type: input
id: game-modify
attributes:
+4 -4
View File
@@ -1,8 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: 开黑啦频道
url: https://kaihei.co/Kx7n3t
about: Hello Minecraft! Launcher 的官方开黑啦频道。
- name: KOOK 频道
url: https://kook.top/Kx7n3t
about: Hello Minecraft! Launcher 的官方 KOOK 频道。
- name: Discord 频道
url: https://discord.gg/jVvC7HfM6U
about: Hello Minecraft! Launcher 的官方 Discord 频道。
@@ -11,4 +11,4 @@ contact_links:
about: 前往爱发电赞助 HMCL。赞助后可以申请加入官方 QQ 群反馈问题。
- name: 其他反馈
url: https://github.com/huanghongxun/HMCL/issues/new
about: 通过 Issue 反馈其他问题。
about: 通过 Issue 反馈其他问题。
+1
View File
@@ -266,6 +266,7 @@ val makeExecutables = tasks.create("makeExecutables") {
doLast {
createExecutable("exe", "src/main/resources/assets/HMCLauncher.exe")
createExecutable("sh", "src/main/resources/assets/HMCLauncher.sh")
}
}
@@ -69,6 +69,12 @@ public final class Launcher extends Application {
Main.showWarningAndContinue(i18n("fatal.illegal_char"));
}
if (!Architecture.CURRENT_ARCH.isX86()
&& !(OperatingSystem.CURRENT_OS == OperatingSystem.OSX && Architecture.CURRENT_ARCH == Architecture.ARM64)
&& ConfigHolder.globalConfig().getAgreementVersion() < 1) {
Main.showWarningAndContinue(i18n("fatal.unsupported_platform"));
}
// runLater to ensure ConfigHolder.init() finished initialization
Platform.runLater(() -> {
// When launcher visibility is set to "hide and reopen" without Platform.implicitExit = false,
@@ -19,6 +19,7 @@ package org.jackhuang.hmcl;
import org.jackhuang.hmcl.util.Logging;
import org.jackhuang.hmcl.util.SelfDependencyPatcher;
import org.jackhuang.hmcl.util.platform.Architecture;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
@@ -97,7 +98,12 @@ public final class Main {
showErrorAndExit(i18n("fatal.javafx.missing"));
} catch (SelfDependencyPatcher.IncompatibleVersionException e) {
LOG.log(Level.SEVERE, "unable to patch JVM", e);
showErrorAndExit(i18n("fatal.javafx.incompatible"));
if (Architecture.CURRENT_ARCH == Architecture.MIPS64EL
|| Architecture.CURRENT_ARCH == Architecture.LOONGARCH64
|| Architecture.CURRENT_ARCH == Architecture.LOONGARCH64_OW)
showErrorAndExit(i18n("fatal.javafx.incompatible.loongson"));
else
showErrorAndExit(i18n("fatal.javafx.incompatible"));
} catch (CancellationException e) {
LOG.log(Level.SEVERE, "User cancels downloading JavaFX", e);
System.exit(0);
@@ -355,6 +355,7 @@ public class HMCLGameRepository extends DefaultGameRepository {
.setNativesDirType(vs.getNativesDirType())
.setNativesDir(vs.getNativesDir())
.setProcessPriority(vs.getProcessPriority())
.setUseSoftwareRenderer(vs.isUseSoftwareRenderer())
.setUseNativeGLFW(vs.isUseNativeGLFW())
.setUseNativeOpenAL(vs.isUseNativeOpenAL())
.setDaemon(!makeLaunchScript && vs.getLauncherVisibility().isDaemon())
@@ -26,18 +26,13 @@ import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorDownloadException;
import org.jackhuang.hmcl.download.DefaultDependencyManager;
import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.download.MaintainTask;
import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask;
import org.jackhuang.hmcl.download.game.GameVerificationFixTask;
import org.jackhuang.hmcl.download.game.LibraryDownloadException;
import org.jackhuang.hmcl.download.game.*;
import org.jackhuang.hmcl.download.java.JavaRepository;
import org.jackhuang.hmcl.launch.*;
import org.jackhuang.hmcl.mod.ModpackCompletionException;
import org.jackhuang.hmcl.mod.ModpackConfiguration;
import org.jackhuang.hmcl.mod.ModpackProvider;
import org.jackhuang.hmcl.setting.DownloadProviders;
import org.jackhuang.hmcl.setting.LauncherVisibility;
import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.setting.VersionSetting;
import org.jackhuang.hmcl.setting.*;
import org.jackhuang.hmcl.task.*;
import org.jackhuang.hmcl.ui.*;
import org.jackhuang.hmcl.ui.construct.*;
@@ -121,31 +116,25 @@ public final class LauncherHelper {
private void launch0() {
HMCLGameRepository repository = profile.getRepository();
DefaultDependencyManager dependencyManager = profile.getDependency();
Version version = MaintainTask.maintain(repository, repository.getResolvedVersion(selectedVersion));
Optional<String> gameVersion = repository.getGameVersion(version);
AtomicReference<Version> version = new AtomicReference<>(MaintainTask.maintain(repository, repository.getResolvedVersion(selectedVersion)));
Optional<String> gameVersion = repository.getGameVersion(version.get());
boolean integrityCheck = repository.unmarkVersionLaunchedAbnormally(selectedVersion);
CountDownLatch launchingLatch = new CountDownLatch(1);
List<String> javaAgents = new ArrayList<>(0);
AtomicReference<JavaVersion> javaVersionRef = new AtomicReference<>();
getLog4jPatch(version).ifPresent(javaAgents::add);
getLog4jPatch(version.get()).ifPresent(javaAgents::add);
TaskExecutor executor = checkGameState(profile, setting, version)
TaskExecutor executor = checkGameState(profile, setting, version.get())
.thenComposeAsync(javaVersion -> {
javaVersionRef.set(Objects.requireNonNull(javaVersion));
return dependencyManager.checkPatchCompletionAsync(repository.getVersion(selectedVersion), integrityCheck);
})
.thenComposeAsync(Task.allOf(
Task.composeAsync(() -> {
if (setting.isNotCheckGame())
return null;
else
return dependencyManager.checkGameCompletionAsync(version, integrityCheck);
}), Task.composeAsync(() -> {
if (setting.isNotCheckGame()) {
return null;
} else {
version.set(NativePatcher.patchNative(version.get(), gameVersion.orElse(null), javaVersion, setting));
if (setting.isNotCheckGame())
return null;
return Task.allOf(
dependencyManager.checkGameCompletionAsync(version.get(), integrityCheck),
Task.composeAsync(() -> {
try {
ModpackConfiguration<?> configuration = ModpackHelper.readModpackConfiguration(repository.getModpackConfiguration(selectedVersion));
ModpackProvider provider = ModpackHelper.getProviderByType(configuration.getType());
@@ -154,10 +143,33 @@ public final class LauncherHelper {
} catch (IOException e) {
return null;
}
}
}))).withStage("launch.state.dependencies")
}),
Task.composeAsync(() -> {
if (setting.isUseSoftwareRenderer() && OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
Library lib = NativePatcher.getSoftwareRendererLoader(javaVersion);
if (lib == null)
return null;
File file = dependencyManager.getGameRepository().getLibraryFile(version.get(), lib);
if (file.getAbsolutePath().indexOf('=') >= 0) {
LOG.warning("Invalid character '=' in the libraries directory path, unable to attach software renderer loader");
return null;
}
if (GameLibrariesTask.shouldDownloadLibrary(repository, version.get(), lib, integrityCheck)) {
return new LibraryDownloadTask(dependencyManager, file, lib)
.thenRunAsync(() -> javaAgents.add(file.getAbsolutePath()));
} else {
javaAgents.add(file.getAbsolutePath());
return null;
}
} else {
return null;
}
})
);
}).withStage("launch.state.dependencies")
.thenComposeAsync(() -> {
return gameVersion.map(s -> new GameVerificationFixTask(dependencyManager, s, version)).orElse(null);
return gameVersion.map(s -> new GameVerificationFixTask(dependencyManager, s, version.get())).orElse(null);
})
.thenComposeAsync(Task.supplyAsync(() -> {
try {
@@ -174,12 +186,12 @@ public final class LauncherHelper {
LaunchOptions launchOptions = repository.getLaunchOptions(selectedVersion, javaVersionRef.get(), profile.getGameDir(), javaAgents, scriptFile != null);
return new HMCLGameLauncher(
repository,
version,
version.get(),
authInfo,
launchOptions,
launcherVisibility == LauncherVisibility.CLOSE
? null // Unnecessary to start listening to game process output when close launcher immediately after game launched.
: new HMCLProcessListener(repository, version, authInfo, launchOptions, launchingLatch, gameVersion.isPresent())
: new HMCLProcessListener(repository, version.get(), authInfo, launchOptions, launchingLatch, gameVersion.isPresent())
);
}).thenComposeAsync(launcher -> { // launcher is prev task's result
if (scriptFile == null) {
@@ -335,30 +347,32 @@ public final class LauncherHelper {
Runnable continueAction = () -> future.complete(JavaVersion.fromCurrentEnvironment());
if (setting.isJavaAutoSelected()) {
JavaVersionConstraint.VersionRanges range = JavaVersionConstraint.findSuitableJavaVersionRange(gameVersion, version);
GameJavaVersion targetJavaVersion;
GameJavaVersion targetJavaVersion = null;
if (range.getMandatory().contains(VersionNumber.asVersion("17.0.1"))) {
targetJavaVersion = GameJavaVersion.JAVA_17;
} else if (range.getMandatory().contains(VersionNumber.asVersion("16.0.1"))) {
targetJavaVersion = GameJavaVersion.JAVA_16;
} else {
String java8Version;
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
java8Version = "1.8.0_51";
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
java8Version = "1.8.0_202";
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX) {
java8Version = "1.8.0_74";
if (org.jackhuang.hmcl.util.platform.Platform.isCompatibleWithX86Java()) {
JavaVersionConstraint.VersionRanges range = JavaVersionConstraint.findSuitableJavaVersionRange(gameVersion, version);
if (range.getMandatory().contains(VersionNumber.asVersion("17.0.1"))) {
targetJavaVersion = GameJavaVersion.JAVA_17;
} else if (range.getMandatory().contains(VersionNumber.asVersion("16.0.1"))) {
targetJavaVersion = GameJavaVersion.JAVA_16;
} else {
java8Version = null;
}
String java8Version;
if (java8Version != null && range.getMandatory().contains(VersionNumber.asVersion(java8Version)))
targetJavaVersion = GameJavaVersion.JAVA_8;
else
targetJavaVersion = null;
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
java8Version = "1.8.0_51";
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
java8Version = "1.8.0_202";
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX) {
java8Version = "1.8.0_74";
} else {
java8Version = null;
}
if (java8Version != null && range.getMandatory().contains(VersionNumber.asVersion(java8Version)))
targetJavaVersion = GameJavaVersion.JAVA_8;
else
targetJavaVersion = null;
}
}
if (targetJavaVersion != null) {
@@ -368,7 +382,9 @@ public final class LauncherHelper {
})
.exceptionally(throwable -> {
LOG.log(Level.WARNING, "Failed to download java", throwable);
Controllers.dialog(i18n("launch.failed.no_accepted_java"), i18n("message.warning"), MessageType.WARNING, continueAction);
Controllers.confirm(i18n("launch.failed.no_accepted_java"), i18n("message.warning"), MessageType.WARNING, continueAction, () -> {
future.completeExceptionally(new CancellationException("No accepted java"));
});
return null;
});
}
@@ -437,40 +453,25 @@ public final class LauncherHelper {
Controllers.confirm(i18n("launch.advice.require_newer_java_version", gameVersion.toString(), 16), i18n("message.warning"), () -> {
FXUtils.openLink(OPENJDK_DOWNLOAD_LINK);
}, breakAction);
return null;
return Task.fromCompletableFuture(future);
case VANILLA_JAVA_17:
Controllers.confirm(i18n("launch.advice.require_newer_java_version", gameVersion.toString(), 17), i18n("message.warning"), () -> {
FXUtils.openLink(OPENJDK_DOWNLOAD_LINK);
}, breakAction);
return null;
return Task.fromCompletableFuture(future);
case VANILLA_JAVA_8:
Controllers.dialog(i18n("launch.advice.java8_1_13"), i18n("message.error"), MessageType.ERROR, breakAction);
return null;
return Task.fromCompletableFuture(future);
case VANILLA_LINUX_JAVA_8:
if (setting.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
Controllers.dialog(i18n("launch.advice.vanilla_linux_java_8"), i18n("message.error"), MessageType.ERROR, breakAction);
return null;
} else {
break;
}
case VANILLA_X86:
if (setting.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER) {
if (Architecture.SYSTEM_ARCH == Architecture.ARM64) {
if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX
// Windows on ARM introduced translation support for x86-64 after 10.0.21277.
|| (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS && OperatingSystem.SYSTEM_BUILD_NUMBER >= 21277)) {
Controllers.dialog(i18n("launch.advice.vanilla_x86.translation"), i18n("message.error"), MessageType.ERROR, breakAction);
return null;
}
}
Controllers.dialog(i18n("launch.advice.vanilla_x86"), i18n("message.error"), MessageType.ERROR, breakAction);
return null;
return Task.fromCompletableFuture(future);
} else {
break;
}
case LAUNCH_WRAPPER:
Controllers.dialog(i18n("launch.advice.java9") + "\n" + i18n("launch.advice.uncorrected"), i18n("message.error"), MessageType.ERROR, breakAction);
return null;
return Task.fromCompletableFuture(future);
}
}
}
@@ -495,7 +496,7 @@ public final class LauncherHelper {
switch (violatedSuggestedConstraint) {
case MODDED_JAVA_7:
Controllers.dialog(i18n("launch.advice.java.modded_java_7"), i18n("message.warning"), MessageType.WARNING, continueAction);
return null;
break;
case MODDED_JAVA_8:
Controllers.dialog(i18n("launch.advice.newer_java"), i18n("message.warning"), MessageType.WARNING, continueAction);
break;
@@ -508,6 +509,14 @@ public final class LauncherHelper {
case MODLAUNCHER_8:
Controllers.dialog(i18n("launch.advice.modlauncher8"), i18n("message.warning"), MessageType.WARNING, continueAction);
break;
case VANILLA_X86:
if (setting.getNativesDirType() == NativesDirectoryType.VERSION_FOLDER
&& org.jackhuang.hmcl.util.platform.Platform.isCompatibleWithX86Java()) {
Controllers.dialog(i18n("launch.advice.vanilla_x86.translation"), i18n("message.warning"), MessageType.WARNING, continueAction);
} else {
continueAction.run();
}
break;
}
}
@@ -597,21 +606,14 @@ public final class LauncherHelper {
private static CompletableFuture<JavaVersion> downloadJavaImpl(GameJavaVersion javaVersion, DownloadProvider downloadProvider) {
CompletableFuture<JavaVersion> future = new CompletableFuture<>();
TaskExecutorDialogPane javaDownloadingPane = new TaskExecutorDialogPane(TaskCancellationAction.NORMAL);
TaskExecutor executor = JavaRepository.downloadJava(javaVersion, downloadProvider)
Controllers.taskDialog(JavaRepository.downloadJava(javaVersion, downloadProvider)
.whenComplete(Schedulers.javafx(), (downloadedJava, exception) -> {
if (exception != null) {
future.completeExceptionally(exception);
} else {
future.complete(downloadedJava);
}
})
.executor(false);
javaDownloadingPane.setExecutor(executor, true);
Controllers.dialog(javaDownloadingPane);
executor.start();
}), i18n("download.java"), TaskCancellationAction.NORMAL);
return future;
}
@@ -813,7 +815,7 @@ public final class LauncherHelper {
}
private static final String OPENJDK_DOWNLOAD_LINK = "https://docs.microsoft.com/zh-cn/java/openjdk/download";
private static final String OPENJDK_DOWNLOAD_LINK = "https://docs.microsoft.com/java/openjdk/download";
public static final Queue<ManagedProcess> PROCESSES = new ConcurrentLinkedQueue<>();
@@ -81,6 +81,7 @@ public final class Accounts {
public static final YggdrasilAccountFactory FACTORY_MOJANG = YggdrasilAccountFactory.MOJANG;
public static final AuthlibInjectorAccountFactory FACTORY_AUTHLIB_INJECTOR = new AuthlibInjectorAccountFactory(AUTHLIB_INJECTOR_DOWNLOADER, Accounts::getOrCreateAuthlibInjectorServer);
public static final MicrosoftAccountFactory FACTORY_MICROSOFT = new MicrosoftAccountFactory(new MicrosoftService(OAUTH_CALLBACK));
public static final BoundAuthlibInjectorAccountFactory FACTORY_LITTLE_SKIN = getAccountFactoryByAuthlibInjectorServer(new AuthlibInjectorServer("https://littleskin.cn/api/yggdrasil/"));
public static final List<AccountFactory<?>> FACTORIES = immutableListOf(FACTORY_OFFLINE, FACTORY_MOJANG, FACTORY_MICROSOFT, FACTORY_AUTHLIB_INJECTOR);
// ==== login type / account factory mapping ====
@@ -96,14 +97,24 @@ public final class Accounts {
}
public static String getLoginType(AccountFactory<?> factory) {
return Optional.ofNullable(factory2type.get(factory))
.orElseThrow(() -> new IllegalArgumentException("Unrecognized account factory"));
String type = factory2type.get(factory);
if (type != null) return type;
if (factory instanceof BoundAuthlibInjectorAccountFactory) {
return factory2type.get(FACTORY_AUTHLIB_INJECTOR);
}
throw new IllegalArgumentException("Unrecognized account factory");
}
public static AccountFactory<?> getAccountFactory(String loginType) {
return Optional.ofNullable(type2factory.get(loginType))
.orElseThrow(() -> new IllegalArgumentException("Unrecognized login type"));
}
public static BoundAuthlibInjectorAccountFactory getAccountFactoryByAuthlibInjectorServer(AuthlibInjectorServer server) {
return new BoundAuthlibInjectorAccountFactory(AUTHLIB_INJECTOR_DOWNLOADER, server);
}
// ====
public static AccountFactory<?> getAccountFactory(Account account) {
@@ -119,10 +130,10 @@ public final class Accounts {
throw new IllegalArgumentException("Failed to determine account type: " + account);
}
private static ObservableList<Account> accounts = observableArrayList(account -> new Observable[] { account });
private static ReadOnlyListWrapper<Account> accountsWrapper = new ReadOnlyListWrapper<>(Accounts.class, "accounts", accounts);
private static final ObservableList<Account> accounts = observableArrayList(account -> new Observable[] { account });
private static final ReadOnlyListWrapper<Account> accountsWrapper = new ReadOnlyListWrapper<>(Accounts.class, "accounts", accounts);
private static ObjectProperty<Account> selectedAccount = new SimpleObjectProperty<Account>(Accounts.class, "selectedAccount") {
private static final ObjectProperty<Account> selectedAccount = new SimpleObjectProperty<Account>(Accounts.class, "selectedAccount") {
{
accounts.addListener(onInvalidating(this::invalidated));
}
@@ -231,6 +242,14 @@ public final class Accounts {
triggerAuthlibInjectorUpdateCheck();
}
Schedulers.io().execute(() -> {
try {
FACTORY_LITTLE_SKIN.getServer().fetchMetadataResponse();
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to fetch authlib-injector server metdata: " + FACTORY_LITTLE_SKIN.getServer(), e);
}
});
for (AuthlibInjectorServer server : config().getAuthlibInjectorServers()) {
if (selected instanceof AuthlibInjectorAccount && ((AuthlibInjectorAccount) selected).getServer() == server)
continue;
@@ -313,7 +332,7 @@ public final class Accounts {
// ====
// ==== Login type name i18n ===
private static Map<AccountFactory<?>, String> unlocalizedLoginTypeNames = mapOf(
private static final Map<AccountFactory<?>, String> unlocalizedLoginTypeNames = mapOf(
pair(Accounts.FACTORY_OFFLINE, "account.methods.offline"),
pair(Accounts.FACTORY_MOJANG, "account.methods.yggdrasil"),
pair(Accounts.FACTORY_AUTHLIB_INJECTOR, "account.methods.authlib_injector"),
@@ -153,6 +153,7 @@ public class GlobalConfig implements Cloneable, Observable {
private static final Set<String> knownFields = new HashSet<>(Arrays.asList(
"agreementVersion",
"multiplayerToken",
"multiplayerRelay",
"multiplayerAgreementVersion"
));
@@ -392,6 +392,20 @@ public final class VersionSetting implements Cloneable {
notCheckGameProperty.set(notCheckGame);
}
private final BooleanProperty notPatchNativesProperty = new SimpleBooleanProperty(this, "notPatchNatives", false);
public BooleanProperty notPatchNativesProperty() {
return notPatchNativesProperty;
}
public boolean isNotPatchNatives() {
return notPatchNativesProperty.get();
}
public void setNotPatchNatives(boolean notPatchNatives) {
notPatchNativesProperty.set(notPatchNatives);
}
private final BooleanProperty showLogsProperty = new SimpleBooleanProperty(this, "showLogs", false);
public BooleanProperty showLogsProperty() {
@@ -540,6 +554,20 @@ public final class VersionSetting implements Cloneable {
processPriorityProperty.set(processPriority);
}
private final BooleanProperty useSoftwareRenderer = new SimpleBooleanProperty(this, "softwareRenderer", false);
public boolean isUseSoftwareRenderer() {
return useSoftwareRenderer.get();
}
public BooleanProperty useSoftwareRendererProperty() {
return useSoftwareRenderer;
}
public void setUseSoftwareRenderer(boolean useSoftwareRenderer) {
this.useSoftwareRenderer.set(useSoftwareRenderer);
}
private final BooleanProperty useNativeGLFW = new SimpleBooleanProperty(this, "nativeGLFW", false);
public boolean isUseNativeGLFW() {
@@ -610,7 +638,7 @@ public final class VersionSetting implements Cloneable {
public Task<JavaVersion> getJavaVersion(VersionNumber gameVersion, Version version, boolean checkJava) {
return Task.runAsync(Schedulers.javafx(), () -> {
if (StringUtils.isBlank(getJava())) {
setJava(StringUtils.isBlank(getJavaDir()) ? "Default" : "Custom");
setJava(StringUtils.isBlank(getJavaDir()) ? "Auto" : "Custom");
}
}).thenSupplyAsync(() -> {
try {
@@ -633,7 +661,7 @@ public final class VersionSetting implements Cloneable {
.collect(Collectors.toList());
if (matchedJava.isEmpty()) {
runInFX(() -> {
setJava("Default");
setJava("Auto");
});
return JavaVersion.fromCurrentEnvironment();
} else {
@@ -670,6 +698,7 @@ public final class VersionSetting implements Cloneable {
noJVMArgsProperty.addListener(listener);
notCheckGameProperty.addListener(listener);
notCheckJVMProperty.addListener(listener);
notPatchNativesProperty.addListener(listener);
showLogsProperty.addListener(listener);
serverIpProperty.addListener(listener);
fullscreenProperty.addListener(listener);
@@ -678,6 +707,7 @@ public final class VersionSetting implements Cloneable {
gameDirTypeProperty.addListener(listener);
gameDirProperty.addListener(listener);
processPriorityProperty.addListener(listener);
useSoftwareRenderer.addListener(listener);
useNativeGLFW.addListener(listener);
useNativeOpenAL.addListener(listener);
launcherVisibilityProperty.addListener(listener);
@@ -706,6 +736,7 @@ public final class VersionSetting implements Cloneable {
versionSetting.setNoJVMArgs(isNoJVMArgs());
versionSetting.setNotCheckGame(isNotCheckGame());
versionSetting.setNotCheckJVM(isNotCheckJVM());
versionSetting.setNotPatchNatives(isNotPatchNatives());
versionSetting.setShowLogs(isShowLogs());
versionSetting.setServerIp(getServerIp());
versionSetting.setFullscreen(isFullscreen());
@@ -714,6 +745,7 @@ public final class VersionSetting implements Cloneable {
versionSetting.setGameDirType(getGameDirType());
versionSetting.setGameDir(getGameDir());
versionSetting.setProcessPriority(getProcessPriority());
versionSetting.setUseSoftwareRenderer(isUseSoftwareRenderer());
versionSetting.setUseNativeGLFW(isUseNativeGLFW());
versionSetting.setUseNativeOpenAL(isUseNativeOpenAL());
versionSetting.setLauncherVisibility(getLauncherVisibility());
@@ -747,10 +779,12 @@ public final class VersionSetting implements Cloneable {
obj.addProperty("noJVMArgs", src.isNoJVMArgs());
obj.addProperty("notCheckGame", src.isNotCheckGame());
obj.addProperty("notCheckJVM", src.isNotCheckJVM());
obj.addProperty("notPatchNatives", src.isNotPatchNatives());
obj.addProperty("showLogs", src.isShowLogs());
obj.addProperty("gameDir", src.getGameDir());
obj.addProperty("launcherVisibility", src.getLauncherVisibility().ordinal());
obj.addProperty("processPriority", src.getProcessPriority().ordinal());
obj.addProperty("useSoftwareRenderer", src.isUseSoftwareRenderer());
obj.addProperty("useNativeGLFW", src.isUseNativeGLFW());
obj.addProperty("useNativeOpenAL", src.isUseNativeOpenAL());
obj.addProperty("gameDirType", src.getGameDirType().ordinal());
@@ -793,9 +827,11 @@ public final class VersionSetting implements Cloneable {
vs.setNoJVMArgs(Optional.ofNullable(obj.get("noJVMArgs")).map(JsonElement::getAsBoolean).orElse(false));
vs.setNotCheckGame(Optional.ofNullable(obj.get("notCheckGame")).map(JsonElement::getAsBoolean).orElse(false));
vs.setNotCheckJVM(Optional.ofNullable(obj.get("notCheckJVM")).map(JsonElement::getAsBoolean).orElse(false));
vs.setNotPatchNatives(Optional.ofNullable(obj.get("notPatchNatives")).map(JsonElement::getAsBoolean).orElse(false));
vs.setShowLogs(Optional.ofNullable(obj.get("showLogs")).map(JsonElement::getAsBoolean).orElse(false));
vs.setLauncherVisibility(LauncherVisibility.values()[Optional.ofNullable(obj.get("launcherVisibility")).map(JsonElement::getAsInt).orElse(LauncherVisibility.HIDE.ordinal())]);
vs.setProcessPriority(ProcessPriority.values()[Optional.ofNullable(obj.get("processPriority")).map(JsonElement::getAsInt).orElse(ProcessPriority.NORMAL.ordinal())]);
vs.setUseSoftwareRenderer(Optional.ofNullable(obj.get("useSoftwareRenderer")).map(JsonElement::getAsBoolean).orElse(false));
vs.setUseNativeGLFW(Optional.ofNullable(obj.get("useNativeGLFW")).map(JsonElement::getAsBoolean).orElse(false));
vs.setUseNativeOpenAL(Optional.ofNullable(obj.get("useNativeOpenAL")).map(JsonElement::getAsBoolean).orElse(false));
vs.setGameDirType(GameDirectoryType.values()[Optional.ofNullable(obj.get("gameDirType")).map(JsonElement::getAsInt).orElse(GameDirectoryType.ROOT_FOLDER.ordinal())]);
@@ -31,7 +31,6 @@ import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.jackhuang.hmcl.Launcher;
import org.jackhuang.hmcl.Metadata;
import org.jackhuang.hmcl.download.java.JavaRepository;
import org.jackhuang.hmcl.game.ModpackHelper;
import org.jackhuang.hmcl.setting.Accounts;
import org.jackhuang.hmcl.setting.EnumCommonDirectory;
@@ -173,7 +172,7 @@ public final class Controllers {
dialog(i18n("launcher.cache_directory.invalid"));
}
Task.runAsync(JavaVersion::initialize).thenRunAsync(JavaRepository::initialize).start();
Task.runAsync(JavaVersion::initialize).start();
scene = new Scene(decorator.getDecorator());
scene.setFill(Color.TRANSPARENT);
@@ -390,11 +390,19 @@ public final class FXUtils {
try {
Runtime.getRuntime().exec(new String[]{"explorer.exe", "/select,", file.toAbsolutePath().toString()});
} catch (IOException e) {
Logging.LOG.log(Level.SEVERE, "Unable to open " + file + " by executing explorer /select", e);
Logging.LOG.log(Level.SEVERE, "Unable to open " + file + " by executing explorer /select," + file, e);
}
break;
case OSX:
try {
Runtime.getRuntime().exec(new String[]{"/usr/bin/open", "-R", file.toAbsolutePath().toString()});
} catch (IOException e) {
Logging.LOG.log(Level.SEVERE, "Unable to open " + file + " by executing /usr/bin/open -R " + file, e);
}
break;
default:
// Currently unsupported.
// We do not have an universal method to show file in file manager.
openFolder(file.getParent().toFile());
break;
}
}
@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.ui;
import com.jfoenix.controls.JFXButton;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.css.PseudoClass;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
@@ -32,9 +33,7 @@ import javafx.scene.control.SkinBase;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.*;
import org.jackhuang.hmcl.download.LibraryAnalyzer;
import org.jackhuang.hmcl.setting.Theme;
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
@@ -59,6 +58,13 @@ public class InstallerItem extends Control {
public final ObjectProperty<EventHandler<? super MouseEvent>> removeAction = new SimpleObjectProperty<>();
public final ObjectProperty<EventHandler<? super MouseEvent>> action = new SimpleObjectProperty<>();
private Style style = Style.LIST_ITEM;
public enum Style {
LIST_ITEM,
CARD,
}
public InstallerItem(LibraryAnalyzer.LibraryType id) {
this(id.getPatchId());
}
@@ -83,12 +89,20 @@ public class InstallerItem extends Control {
case "optifine":
imageUrl = "/assets/img/command.png";
break;
case "quilt":
case "quilt-api":
imageUrl = "/assets/img/quilt.png";
break;
default:
imageUrl = null;
break;
}
}
public void setStyleMode(Style style) {
this.style = style;
}
public void setState(String libraryVersion, boolean incompatibleWithGame, boolean removable) {
this.libraryVersion.set(libraryVersion);
this.incompatibleWithGame.set(incompatibleWithGame);
@@ -111,76 +125,112 @@ public class InstallerItem extends Control {
public final InstallerItem forge = new InstallerItem(FORGE);
public final InstallerItem liteLoader = new InstallerItem(LITELOADER);
public final InstallerItem optiFine = new InstallerItem(OPTIFINE);
public final InstallerItem quilt = new InstallerItem(QUILT);
public final InstallerItem quiltApi = new InstallerItem(QUILT_API);
public InstallerItemGroup() {
forge.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
return null;
}, fabric.libraryVersion));
}, fabric.libraryVersion, quilt.libraryVersion));
liteLoader.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
return null;
}, fabric.libraryVersion));
}, fabric.libraryVersion, quilt.libraryVersion));
optiFine.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
return null;
}, fabric.libraryVersion));
}, fabric.libraryVersion, quilt.libraryVersion));
for (InstallerItem fabric : new InstallerItem[]{fabric, fabricApi}) {
fabric.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
if (forge.libraryVersion.get() != null) return FORGE.getPatchId();
if (liteLoader.libraryVersion.get() != null) return LITELOADER.getPatchId();
if (optiFine.libraryVersion.get() != null) return OPTIFINE.getPatchId();
if (forge.libraryVersion.get() != null) return FORGE.getPatchId();
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
if (quiltApi.libraryVersion.get() != null) return QUILT_API.getPatchId();
return null;
}, optiFine.libraryVersion, forge.libraryVersion));
}, forge.libraryVersion, liteLoader.libraryVersion, optiFine.libraryVersion, quilt.libraryVersion, quiltApi.libraryVersion));
}
fabricApi.dependencyName.bind(Bindings.createStringBinding(() -> {
if (fabric.libraryVersion.get() == null) return FABRIC.getPatchId();
else return null;
}, fabric.libraryVersion));
for (InstallerItem quilt : new InstallerItem[]{quilt, quiltApi}) {
quilt.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
if (fabricApi.libraryVersion.get() != null) return FABRIC_API.getPatchId();
if (forge.libraryVersion.get() != null) return FORGE.getPatchId();
if (liteLoader.libraryVersion.get() != null) return LITELOADER.getPatchId();
if (optiFine.libraryVersion.get() != null) return OPTIFINE.getPatchId();
return null;
}, fabric.libraryVersion, fabricApi.libraryVersion, forge.libraryVersion, liteLoader.libraryVersion, optiFine.libraryVersion));
}
quiltApi.dependencyName.bind(Bindings.createStringBinding(() -> {
if (quilt.libraryVersion.get() == null) return QUILT.getPatchId();
else return null;
}, quilt.libraryVersion));
}
public InstallerItem[] getLibraries() {
return new InstallerItem[]{game, forge, liteLoader, optiFine, fabric, fabricApi};
return new InstallerItem[]{game, forge, liteLoader, optiFine, fabric, fabricApi, quilt, quiltApi};
}
}
public static class InstallerItemSkin extends SkinBase<InstallerItem> {
private static final PseudoClass LIST_ITEM = PseudoClass.getPseudoClass("list-item");
private static final PseudoClass CARD = PseudoClass.getPseudoClass("card");
InstallerItemSkin(InstallerItem control) {
super(control);
HBox hbox = new HBox();
hbox.getStyleClass().add("md-list-cell");
hbox.setPadding(new Insets(8));
RipplerContainer container = new RipplerContainer(hbox);
Pane pane;
if (control.style == Style.CARD) {
pane = new VBox();
} else {
pane = new HBox();
}
pane.getStyleClass().add("installer-item");
RipplerContainer container = new RipplerContainer(pane);
getChildren().setAll(container);
hbox.setAlignment(Pos.CENTER_LEFT);
pane.pseudoClassStateChanged(LIST_ITEM, control.style == Style.LIST_ITEM);
pane.pseudoClassStateChanged(CARD, control.style == Style.CARD);
if (control.imageUrl != null) {
ImageView view = new ImageView(new Image(control.imageUrl, 32, 32, true, true));
Node node = FXUtils.limitingSize(view, 32, 32);
node.setMouseTransparent(true);
hbox.getChildren().add(node);
node.getStyleClass().add("installer-item-image");
pane.getChildren().add(node);
if (control.style == Style.CARD) {
VBox.setMargin(node, new Insets(8, 0, 16, 0));
}
}
Label nameLabel = new Label();
nameLabel.getStyleClass().add("installer-item-name");
nameLabel.setMouseTransparent(true);
hbox.getChildren().add(nameLabel);
nameLabel.setPrefWidth(80);
pane.getChildren().add(nameLabel);
nameLabel.textProperty().set(I18n.hasKey("install.installer." + control.id) ? i18n("install.installer." + control.id) : control.id);
HBox.setMargin(nameLabel, new Insets(0, 4, 0, 4));
Label label = new Label();
label.setMouseTransparent(true);
hbox.getChildren().add(label);
label.setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(label, Priority.ALWAYS);
label.textProperty().bind(Bindings.createStringBinding(() -> {
Label statusLabel = new Label();
statusLabel.getStyleClass().add("installer-item-status");
statusLabel.setMouseTransparent(true);
pane.getChildren().add(statusLabel);
HBox.setHgrow(statusLabel, Priority.ALWAYS);
statusLabel.textProperty().bind(Bindings.createStringBinding(() -> {
String incompatibleWith = control.incompatibleLibraryName.get();
String version = control.libraryVersion.get();
if (control.incompatibleWithGame.get()) {
@@ -193,8 +243,13 @@ public class InstallerItem extends Control {
return i18n("install.installer.version", version);
}
}, control.incompatibleLibraryName, control.incompatibleWithGame, control.libraryVersion));
BorderPane.setMargin(label, new Insets(0, 0, 0, 8));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
BorderPane.setMargin(statusLabel, new Insets(0, 0, 0, 8));
BorderPane.setAlignment(statusLabel, Pos.CENTER_LEFT);
HBox buttonsContainer = new HBox();
buttonsContainer.setSpacing(8);
buttonsContainer.setAlignment(Pos.CENTER);
pane.getChildren().add(buttonsContainer);
JFXButton closeButton = new JFXButton();
closeButton.setGraphic(SVG.close(Theme.blackFillBinding(), -1, -1));
@@ -202,7 +257,7 @@ public class InstallerItem extends Control {
closeButton.visibleProperty().bind(control.removable);
closeButton.managedProperty().bind(closeButton.visibleProperty());
closeButton.onMouseClickedProperty().bind(control.removeAction);
hbox.getChildren().add(closeButton);
buttonsContainer.getChildren().add(closeButton);
JFXButton arrowButton = new JFXButton();
arrowButton.graphicProperty().bind(Bindings.createObjectBinding(() -> control.upgradable.get()
@@ -215,16 +270,16 @@ public class InstallerItem extends Control {
control.installable, control.incompatibleLibraryName));
arrowButton.managedProperty().bind(arrowButton.visibleProperty());
arrowButton.onMouseClickedProperty().bind(control.action);
hbox.getChildren().add(arrowButton);
buttonsContainer.getChildren().add(arrowButton);
FXUtils.onChangeAndOperate(arrowButton.visibleProperty(), clickable -> {
if (clickable) {
container.onMouseClickedProperty().bind(control.action);
hbox.setCursor(Cursor.HAND);
pane.setCursor(Cursor.HAND);
} else {
container.onMouseClickedProperty().unbind();
container.onMouseClickedProperty().set(null);
hbox.setCursor(Cursor.DEFAULT);
pane.setCursor(Cursor.DEFAULT);
}
});
}
@@ -156,7 +156,7 @@ public class AccountListItem extends RadioButton {
return null;
}
if (account instanceof MicrosoftAccount) {
FXUtils.openLink("https://www.minecraft.net/profile/skin");
FXUtils.openLink("https://www.minecraft.net/msaprofile/mygames/editskin");
return null;
}
if (!(account instanceof YggdrasilAccount)) {
@@ -122,6 +122,14 @@ public class AccountListPage extends DecoratorAnimatedPage implements DecoratorP
microsoftItem.setOnAction(e -> Controllers.dialog(new CreateAccountPane(Accounts.FACTORY_MICROSOFT)));
boxMethods.getChildren().add(microsoftItem);
AdvancedListItem littleSkinItem = new AdvancedListItem();
littleSkinItem.getStyleClass().add("navigation-drawer-item");
littleSkinItem.setActionButtonVisible(false);
littleSkinItem.setTitle(i18n("account.methods.little_skin"));
littleSkinItem.setLeftGraphic(wrap(SVG::server));
littleSkinItem.setOnAction(e -> Controllers.dialog(new CreateAccountPane(Accounts.FACTORY_LITTLE_SKIN)));
boxMethods.getChildren().add(littleSkinItem);
VBox boxAuthServers = new VBox();
authServerItems = MappedObservableList.create(skinnable.authServersProperty(), server -> {
AdvancedListItem item = new AdvancedListItem();
@@ -40,6 +40,7 @@ import org.jackhuang.hmcl.auth.CharacterSelector;
import org.jackhuang.hmcl.auth.NoSelectedCharacterException;
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccountFactory;
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
import org.jackhuang.hmcl.auth.authlibinjector.BoundAuthlibInjectorAccountFactory;
import org.jackhuang.hmcl.auth.microsoft.MicrosoftAccountFactory;
import org.jackhuang.hmcl.auth.offline.OfflineAccountFactory;
import org.jackhuang.hmcl.auth.yggdrasil.GameProfile;
@@ -194,9 +195,8 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
setPrefWidth(560);
}
public CreateAccountPane(AuthlibInjectorServer authserver) {
this(Accounts.FACTORY_AUTHLIB_INJECTOR);
((AccountDetailsInputPane) detailsPane).selectAuthServer(authserver);
public CreateAccountPane(AuthlibInjectorServer authServer) {
this(Accounts.getAccountFactoryByAuthlibInjectorServer(authServer));
}
private void onAccept() {
@@ -267,40 +267,49 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
}
if (factory == Accounts.FACTORY_MICROSOFT) {
VBox vbox = new VBox(8);
HintPane hintPane = new HintPane(MessageDialogPane.MessageType.INFO);
FXUtils.onChangeAndOperate(deviceCode, deviceCode -> {
if (deviceCode != null) {
FXUtils.copyText(deviceCode.getUserCode());
hintPane.setSegment(i18n("account.methods.microsoft.manual", deviceCode.getUserCode(), deviceCode.getVerificationUri()));
} else {
hintPane.setSegment(i18n("account.methods.microsoft.hint"));
}
});
hintPane.setOnMouseClicked(e -> {
if (deviceCode.get() != null) {
FXUtils.copyText(deviceCode.get().getUserCode());
}
});
if (!Accounts.OAUTH_CALLBACK.getClientId().isEmpty()) {
HintPane hintPane = new HintPane(MessageDialogPane.MessageType.INFO);
FXUtils.onChangeAndOperate(deviceCode, deviceCode -> {
if (deviceCode != null) {
FXUtils.copyText(deviceCode.getUserCode());
hintPane.setSegment(i18n("account.methods.microsoft.manual", deviceCode.getUserCode(), deviceCode.getVerificationUri()));
} else {
hintPane.setSegment(i18n("account.methods.microsoft.hint"));
}
});
hintPane.setOnMouseClicked(e -> {
if (deviceCode.get() != null) {
FXUtils.copyText(deviceCode.get().getUserCode());
}
});
holder.add(Accounts.OAUTH_CALLBACK.onGrantDeviceCode.registerWeak(value -> {
runInFX(() -> deviceCode.set(value));
}));
HBox box = new HBox(8);
JFXHyperlink birthLink = new JFXHyperlink(i18n("account.methods.microsoft.birth"));
birthLink.setOnAction(e -> FXUtils.openLink("https://support.microsoft.com/account-billing/837badbc-999e-54d2-2617-d19206b9540a"));
JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile"));
profileLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/editprof.aspx"));
JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase"));
JFXHyperlink deauthorizeLink = new JFXHyperlink(i18n("account.methods.microsoft.deauthorize"));
deauthorizeLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/consent/Edit?client_id=000000004C794E0A"));
purchaseLink.setOnAction(e -> FXUtils.openLink(YggdrasilService.PURCHASE_URL));
box.getChildren().setAll(profileLink, birthLink, purchaseLink, deauthorizeLink);
GridPane.setColumnSpan(box, 2);
holder.add(Accounts.OAUTH_CALLBACK.onGrantDeviceCode.registerWeak(value -> {
runInFX(() -> deviceCode.set(value));
}));
HBox box = new HBox(8);
JFXHyperlink birthLink = new JFXHyperlink(i18n("account.methods.microsoft.birth"));
birthLink.setOnAction(e -> FXUtils.openLink("https://support.microsoft.com/account-billing/837badbc-999e-54d2-2617-d19206b9540a"));
JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile"));
profileLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/editprof.aspx"));
JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase"));
JFXHyperlink deauthorizeLink = new JFXHyperlink(i18n("account.methods.microsoft.deauthorize"));
deauthorizeLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/consent/Edit?client_id=000000004C794E0A"));
purchaseLink.setOnAction(e -> FXUtils.openLink(YggdrasilService.PURCHASE_URL));
box.getChildren().setAll(profileLink, birthLink, purchaseLink, deauthorizeLink);
GridPane.setColumnSpan(box, 2);
vbox.getChildren().setAll(hintPane, box);
vbox.getChildren().setAll(hintPane, box);
btnAccept.setDisable(false);
} else {
HintPane hintPane = new HintPane(MessageDialogPane.MessageType.WARNING);
hintPane.setText(i18n("account.methods.microsoft.snapshot"));
vbox.getChildren().setAll(hintPane);
btnAccept.setDisable(true);
}
detailsPane = vbox;
btnAccept.setDisable(false);
} else if (factory == Accounts.FACTORY_MOJANG) {
VBox vbox = new VBox(8);
HintPane hintPane = new HintPane(MessageDialogPane.MessageType.WARNING);
@@ -329,7 +338,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
private static class AccountDetailsInputPane extends GridPane {
// ==== authlib-injector hyperlinks ====
private static final String[] ALLOWED_LINKS = { "register" };
private static final String[] ALLOWED_LINKS = { "homepage", "register" };
private static List<Hyperlink> createHyperlinks(AuthlibInjectorServer server) {
if (server == null) {
@@ -351,12 +360,13 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
}
// =====
private AccountFactory<?> factory;
private final AccountFactory<?> factory;
private @Nullable AuthlibInjectorServer server;
private @Nullable JFXComboBox<AuthlibInjectorServer> cboServers;
private @Nullable JFXTextField txtUsername;
private @Nullable JFXPasswordField txtPassword;
private @Nullable JFXTextField txtUUID;
private BooleanBinding valid;
private final BooleanBinding valid;
public AccountDetailsInputPane(AccountFactory<?> factory, Runnable onAction) {
this.factory = factory;
@@ -374,7 +384,28 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
int rowIndex = 0;
if (factory instanceof AuthlibInjectorAccountFactory) {
if (factory instanceof BoundAuthlibInjectorAccountFactory) {
this.server = ((BoundAuthlibInjectorAccountFactory) factory).getServer();
Label lblServers = new Label(i18n("account.injector.server"));
setHalignment(lblServers, HPos.LEFT);
add(lblServers, 0, rowIndex);
Label lblServerName = new Label(this.server.getName());
lblServerName.setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(lblServerName, Priority.ALWAYS);
HBox linksContainer = new HBox();
linksContainer.setAlignment(Pos.CENTER);
linksContainer.getChildren().setAll(createHyperlinks(this.server));
linksContainer.setMinWidth(USE_PREF_SIZE);
HBox boxServers = new HBox(lblServerName, linksContainer);
boxServers.setAlignment(Pos.CENTER_LEFT);
add(boxServers, 1, rowIndex);
rowIndex++;
} else if (factory instanceof AuthlibInjectorAccountFactory) {
Label lblServers = new Label(i18n("account.injector.server"));
setHalignment(lblServers, HPos.LEFT);
add(lblServers, 0, rowIndex);
@@ -397,7 +428,10 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
HBox linksContainer = new HBox();
linksContainer.setAlignment(Pos.CENTER);
onChangeAndOperate(cboServers.valueProperty(), server -> linksContainer.getChildren().setAll(createHyperlinks(server)));
onChangeAndOperate(cboServers.valueProperty(), server -> {
this.server = server;
linksContainer.getChildren().setAll(createHyperlinks(server));
});
linksContainer.setMinWidth(USE_PREF_SIZE);
JFXButton btnAddServer = new JFXButton();
@@ -542,11 +576,8 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
private boolean requiresEmailAsUsername() {
if (factory instanceof YggdrasilAccountFactory) {
return true;
} else if ((factory instanceof AuthlibInjectorAccountFactory) && cboServers != null) {
AuthlibInjectorServer server = cboServers.getValue();
if (server != null && !server.isNonEmailLogin()) {
return true;
}
} else if ((factory instanceof AuthlibInjectorAccountFactory) && this.server != null) {
return !server.isNonEmailLogin();
}
return false;
}
@@ -563,7 +594,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
}
public @Nullable AuthlibInjectorServer getAuthServer() {
return cboServers == null ? null : cboServers.getValue();
return this.server;
}
public @Nullable String getUsername() {
@@ -578,10 +609,6 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
return valid;
}
public void selectAuthServer(AuthlibInjectorServer authserver) {
cboServers.getSelectionModel().select(authserver);
}
public void focus() {
if (txtUsername != null) {
txtUsername.requestFocus();
@@ -61,7 +61,7 @@ public class OAuthAccountLoginDialog extends DialogPane {
HBox box = new HBox(8);
JFXHyperlink birthLink = new JFXHyperlink(i18n("account.methods.microsoft.birth"));
birthLink.setOnAction(e -> FXUtils.openLink("https://support.microsoft.com/zh-cn/account-billing/如何更改-microsoft-帐户上的出生日期-837badbc-999e-54d2-2617-d19206b9540a"));
birthLink.setOnAction(e -> FXUtils.openLink("https://support.microsoft.com/account-billing/how-to-change-a-birth-date-on-a-microsoft-account-837badbc-999e-54d2-2617-d19206b9540a"));
JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile"));
profileLink.setOnAction(e -> FXUtils.openLink("https://account.live.com/editprof.aspx"));
JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.yggdrasil.purchase"));
@@ -0,0 +1,57 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2020 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.ui.construct;
import com.jfoenix.validation.base.ValidatorBase;
import javafx.beans.NamedArg;
import javafx.scene.control.TextInputControl;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
public class DoubleValidator extends ValidatorBase {
private final boolean nullable;
public DoubleValidator() {
this(false);
}
public DoubleValidator(@NamedArg("nullable") boolean nullable) {
this.nullable = nullable;
}
public DoubleValidator(@NamedArg("message") String message, @NamedArg("nullable") boolean nullable) {
super(message);
this.nullable = nullable;
}
@Override
protected void eval() {
if (srcControl.get() instanceof TextInputControl) {
evalTextInputField();
}
}
private void evalTextInputField() {
TextInputControl textField = ((TextInputControl) srcControl.get());
if (StringUtils.isBlank(textField.getText()))
hasErrors.set(!nullable);
else
hasErrors.set(Lang.toDoubleOrNull(textField.getText()) == null);
}
}
@@ -34,6 +34,7 @@ import org.jackhuang.hmcl.download.forge.ForgeNewInstallTask;
import org.jackhuang.hmcl.download.forge.ForgeOldInstallTask;
import org.jackhuang.hmcl.download.game.GameAssetDownloadTask;
import org.jackhuang.hmcl.download.game.GameInstallTask;
import org.jackhuang.hmcl.download.java.JavaDownloadTask;
import org.jackhuang.hmcl.download.liteloader.LiteLoaderInstallTask;
import org.jackhuang.hmcl.download.optifine.OptiFineInstallTask;
import org.jackhuang.hmcl.game.HMCLModpackInstallTask;
@@ -148,6 +149,8 @@ public final class TaskListPane extends StackPane {
task.setName(i18n("modpack.export"));
} else if (task instanceof MinecraftInstanceTask) {
task.setName(i18n("modpack.scan"));
} else if (task instanceof JavaDownloadTask) {
task.setName(i18n("download.java"));
}
Platform.runLater(() -> {
@@ -243,6 +246,7 @@ public final class TaskListPane extends StackPane {
case "hmcl.install.optifine": message = i18n("install.installer.install", i18n("install.installer.optifine") + " " + stageValue); break;
case "hmcl.install.fabric": message = i18n("install.installer.install", i18n("install.installer.fabric") + " " + stageValue); break;
case "hmcl.install.fabric-api": message = i18n("install.installer.install", i18n("install.installer.fabric-api") + " " + stageValue); break;
case "hmcl.install.quilt": message = i18n("install.installer.install", i18n("install.installer.quilt") + " " + stageValue); break;
default: message = i18n(stageKey); break;
}
// @formatter:on
@@ -29,14 +29,13 @@ import javafx.scene.control.Label;
import javafx.scene.control.Skin;
import javafx.scene.control.SkinBase;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.download.RemoteVersion;
import org.jackhuang.hmcl.game.HMCLGameRepository;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.InstallerItem;
import org.jackhuang.hmcl.ui.construct.ComponentList;
import org.jackhuang.hmcl.ui.construct.MessageDialogPane;
import org.jackhuang.hmcl.ui.construct.RequiredValidator;
import org.jackhuang.hmcl.ui.construct.Validator;
@@ -67,6 +66,10 @@ public class InstallersPage extends Control implements WizardPage {
group.game.installable.setValue(false);
for (InstallerItem item : group.getLibraries()) {
item.setStyleMode(InstallerItem.Style.CARD);
}
for (InstallerItem library : group.getLibraries()) {
String libraryId = library.getLibraryId();
if (libraryId.equals("game")) continue;
@@ -140,22 +143,23 @@ public class InstallersPage extends Control implements WizardPage {
BorderPane root = new BorderPane();
root.setPadding(new Insets(16));
ComponentList list = new ComponentList();
list.getStyleClass().add("no-padding");
root.setCenter(list);
{
HBox versionNamePane = new HBox(8);
versionNamePane.getStyleClass().add("card-non-transparent");
versionNamePane.setStyle("-fx-padding: 20 8 20 16");
versionNamePane.setAlignment(Pos.CENTER_LEFT);
versionNamePane.setPadding(new Insets(20, 8, 20, 16));
control.txtName.setMaxWidth(300);
versionNamePane.getChildren().setAll(new Label(i18n("archive.name")), control.txtName);
list.getContent().add(versionNamePane);
root.setTop(versionNamePane);
}
{
VBox libraryPane = new VBox(control.group.getLibraries());
list.getContent().add(libraryPane);
FlowPane libraryPane = new FlowPane(control.group.getLibraries());
BorderPane.setMargin(libraryPane, new Insets(16, 0, 16, 0));
libraryPane.setVgap(16);
libraryPane.setHgap(16);
root.setCenter(libraryPane);
}
@@ -23,6 +23,7 @@ import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.layout.StackPane;
import javafx.stage.FileChooser;
import org.jackhuang.hmcl.game.ModpackHelper;
import org.jackhuang.hmcl.mod.server.ServerModpackManifest;
import org.jackhuang.hmcl.task.FileDownloadTask;
import org.jackhuang.hmcl.task.GetTask;
@@ -33,7 +34,6 @@ import org.jackhuang.hmcl.ui.wizard.WizardController;
import org.jackhuang.hmcl.ui.wizard.WizardPage;
import org.jackhuang.hmcl.util.TaskCancellationAction;
import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.io.FileUtils;
import java.io.File;
import java.io.IOException;
@@ -67,7 +67,7 @@ public final class ModpackSelectionPage extends StackPane implements WizardPage
Platform.runLater(controller::onNext);
}
FXUtils.applyDragListener(this, it -> "zip".equals(FileUtils.getExtension(it)), modpacks -> {
FXUtils.applyDragListener(this, ModpackHelper::isFileModpackByExtension, modpacks -> {
File modpack = modpacks.get(0);
controller.getSettings().put(MODPACK_FILE, modpack);
controller.onNext();
@@ -78,7 +78,7 @@ public final class ModpackSelectionPage extends StackPane implements WizardPage
private void onChooseLocalFile() {
FileChooser chooser = new FileChooser();
chooser.setTitle(i18n("modpack.choose"));
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(i18n("modpack"), "*.zip"));
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(i18n("modpack"), "*.zip", "*.mrpack"));
File selectedFile = chooser.showOpenDialog(Controllers.getStage());
if (selectedFile == null) {
Platform.runLater(controller::onEnd);
@@ -96,7 +96,7 @@ public class AboutPage extends StackPane {
noin.setImage(new Image("/assets/img/noin.png", 32, 32, false, true));
noin.setTitle(i18n("about.thanks_to.noin"));
noin.setSubtitle(i18n("about.thanks_to.noin.statement"));
noin.setExternalLink("https://mcer.cn/");
noin.setExternalLink("https://mcer.cn/cato");
IconedTwoLineListItem contributors = new IconedTwoLineListItem();
contributors.setImage(new Image("/assets/img/github.png", 32, 32, false, true));
@@ -121,13 +121,13 @@ public class AboutPage extends StackPane {
discord.setSubtitle(i18n("about.community.discord.statement"));
discord.setExternalLink("https://discord.gg/jVvC7HfM6U");
IconedTwoLineListItem kaiheila = new IconedTwoLineListItem();
kaiheila.setImage(new Image("/assets/img/kaiheila.jpeg", 32, 32, false, true));
kaiheila.setTitle(i18n("about.community.kaiheila"));
kaiheila.setSubtitle(i18n("about.community.kaiheila.statement"));
kaiheila.setExternalLink("https://kaihei.co/Kx7n3t");
IconedTwoLineListItem kookapp = new IconedTwoLineListItem();
kookapp.setImage(new Image("/assets/img/kookapp.png", 32, 32, false, true));
kookapp.setTitle(i18n("about.community.kookapp"));
kookapp.setSubtitle(i18n("about.community.kookapp.statement"));
kookapp.setExternalLink("https://kook.top/Kx7n3t");
community.getContent().setAll(users, discord, kaiheila);
community.getContent().setAll(users, discord, kookapp);
}
ComponentList dep = new ComponentList();
@@ -191,7 +191,10 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
}
protected String getLocalizedCategoryIndent(ModDownloadListPageSkin.CategoryIndented category) {
return StringUtils.repeats(' ', category.indent * 4) + getLocalizedCategory(category.getCategory() == null ? "0" : category.getCategory().getId());
return StringUtils.repeats(' ', category.indent * 4) +
(category.getCategory() == null
? i18n("curse.category.0")
: getLocalizedCategory(category.getCategory().getId()));
}
protected String getLocalizedOfficialPage() {
@@ -309,15 +312,17 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
categoryComboBox.setPromptText(i18n("mods.category"));
categoryComboBox.getSelectionModel().select(0);
categoryComboBox.setConverter(stringConverter(getSkinnable()::getLocalizedCategoryIndent));
Task.supplyAsync(() -> getSkinnable().repository.getCategories())
.thenAcceptAsync(Schedulers.javafx(), categories -> {
List<CategoryIndented> result = new ArrayList<>();
result.add(new CategoryIndented(0, null));
for (RemoteModRepository.Category category : Lang.toIterable(categories)) {
resolveCategory(category, 0, result);
}
categoryComboBox.getItems().setAll(result);
}).start();
FXUtils.onChangeAndOperate(getSkinnable().downloadSource, downloadSource -> {
Task.supplyAsync(() -> getSkinnable().repository.getCategories())
.thenAcceptAsync(Schedulers.javafx(), categories -> {
List<CategoryIndented> result = new ArrayList<>();
result.add(new CategoryIndented(0, null));
for (RemoteModRepository.Category category : Lang.toIterable(categories)) {
resolveCategory(category, 0, result);
}
categoryComboBox.getItems().setAll(result);
}).start();
});
StackPane sortStackPane = new StackPane();
JFXComboBox<RemoteModRepository.SortType> sortComboBox = new JFXComboBox<>();
@@ -204,14 +204,14 @@ public class DownloadPage extends Control implements DecoratorPage {
return;
}
Controllers.taskDialog(Task.composeAsync(() -> {
Controllers.taskDialog(
Task.composeAsync(() -> {
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(file.getFile().getUrl()), dest, file.getFile().getIntegrityCheck());
task.setName(file.getName());
return task;
}),
i18n("message.downloading"),
TaskCancellationAction.NORMAL
);
TaskCancellationAction.NORMAL);
}
@Override
@@ -261,7 +261,7 @@ public class DownloadPage extends Control implements DecoratorPage {
if (getSkinnable().mod != null) {
JFXHyperlink openMcmodButton = new JFXHyperlink(i18n("mods.mcmod"));
openMcmodButton.setOnAction(e -> FXUtils.openLink(ModManager.getMcmodUrl(getSkinnable().mod.getMcmod())));
openMcmodButton.setOnAction(e -> FXUtils.openLink(getSkinnable().translations.getMcmodUrl(getSkinnable().mod)));
descriptionPane.getChildren().add(openMcmodButton);
if (StringUtils.isNotBlank(getSkinnable().mod.getMcbbs())) {
@@ -261,7 +261,7 @@ class ModListPageSkin extends SkinBase<ModListPage> {
mcmodButton.setText(i18n("mods.mcmod.page"));
mcmodButton.setOnAction(e -> {
fireEvent(new DialogCloseEvent());
FXUtils.openLink(ModManager.getMcmodUrl(modInfo.getMod().getMcmod()));
FXUtils.openLink(ModTranslations.MOD.getMcmodUrl(modInfo.getMod()));
});
getActions().add(mcmodButton);
}
@@ -36,10 +36,25 @@ import static org.jackhuang.hmcl.util.Pair.pair;
*
* @see <a href="https://www.mcmod.cn">mcmod.cn</a>
*/
public final class ModTranslations {
public static ModTranslations MOD = new ModTranslations("/assets/mod_data.txt");
public static ModTranslations MODPACK = new ModTranslations("/assets/modpack_data.txt");
public static ModTranslations EMPTY = new ModTranslations("");
public enum ModTranslations {
MOD("/assets/mod_data.txt") {
@Override
public String getMcmodUrl(Mod mod) {
return String.format("https://www.mcmod.cn/class/%s.html", mod.getMcmod());
}
},
MODPACK("/assets/modpack_data.txt") {
@Override
public String getMcmodUrl(Mod mod) {
return String.format("https://www.mcmod.cn/modpack/%s.html", mod.getMcmod());
}
},
EMPTY("") {
@Override
public String getMcmodUrl(Mod mod) {
return "";
}
};
public static ModTranslations getTranslationsByRepositoryType(RemoteModRepository.Type type) {
switch (type) {
@@ -59,7 +74,7 @@ public final class ModTranslations {
private List<Pair<String, Mod>> keywords;
private int maxKeywordLength = -1;
private ModTranslations(String resourceName) {
ModTranslations(String resourceName) {
this.resourceName = resourceName;
}
@@ -77,6 +92,8 @@ public final class ModTranslations {
return modIdMap.get(id);
}
public abstract String getMcmodUrl(Mod mod);
public List<Mod> searchMod(String query) {
if (!loadKeywords()) return Collections.emptyList();
@@ -90,6 +90,8 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
private final OptionToggleButton noJVMArgsPane;
private final OptionToggleButton noGameCheckPane;
private final OptionToggleButton noJVMCheckPane;
private final OptionToggleButton noNativesPatchPane;
private final OptionToggleButton useSoftwareRenderer;
private final OptionToggleButton useNativeGLFWPane;
private final OptionToggleButton useNativeOpenALPane;
private final ComponentSublist javaSublist;
@@ -462,10 +464,14 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
pane.getColumnConstraints().setAll(title, value);
txtJVMArgs = new JFXTextField();
txtJVMArgs.setPromptText(i18n("settings.advanced.jvm_args.prompt"));
txtJVMArgs.getStyleClass().add("fit-width");
pane.addRow(0, new Label(i18n("settings.advanced.jvm_args")), txtJVMArgs);
HintPane hintPane = new HintPane();
hintPane.setText(i18n("settings.advanced.jvm_args.prompt"));
GridPane.setColumnSpan(hintPane, 2);
pane.addRow(4, hintPane);
txtMetaspace = new JFXTextField();
txtMetaspace.setPromptText(i18n("settings.advanced.java_permanent_generation_space.prompt"));
txtMetaspace.getStyleClass().add("fit-width");
@@ -508,13 +514,22 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
noJVMCheckPane = new OptionToggleButton();
noJVMCheckPane.setTitle(i18n("settings.advanced.dont_check_jvm_validity"));
noNativesPatchPane = new OptionToggleButton();
noNativesPatchPane.setTitle(i18n("settings.advanced.dont_patch_natives"));
useSoftwareRenderer = new OptionToggleButton();
useSoftwareRenderer.setTitle(i18n("settings.advanced.use_software_renderer"));
useNativeGLFWPane = new OptionToggleButton();
useNativeGLFWPane.setTitle(i18n("settings.advanced.use_native_glfw"));
useNativeOpenALPane = new OptionToggleButton();
useNativeOpenALPane.setTitle(i18n("settings.advanced.use_native_openal"));
workaroundPane.getContent().setAll(nativesDirSublist, noJVMArgsPane, noGameCheckPane, noJVMCheckPane, useNativeGLFWPane, useNativeOpenALPane);
workaroundPane.getContent().setAll(
nativesDirSublist,
noJVMArgsPane, noGameCheckPane, noJVMCheckPane, noNativesPatchPane,
useSoftwareRenderer, useNativeGLFWPane, useNativeOpenALPane);
}
rootPane.getChildren().addAll(componentList,
@@ -631,7 +646,9 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
noGameCheckPane.selectedProperty().unbindBidirectional(lastVersionSetting.notCheckGameProperty());
noJVMCheckPane.selectedProperty().unbindBidirectional(lastVersionSetting.notCheckJVMProperty());
noJVMArgsPane.selectedProperty().unbindBidirectional(lastVersionSetting.noJVMArgsProperty());
noNativesPatchPane.selectedProperty().unbindBidirectional(lastVersionSetting.notPatchNativesProperty());
showLogsPane.selectedProperty().unbindBidirectional(lastVersionSetting.showLogsProperty());
useSoftwareRenderer.selectedProperty().unbindBidirectional(lastVersionSetting.useSoftwareRendererProperty());
useNativeGLFWPane.selectedProperty().unbindBidirectional(lastVersionSetting.useNativeGLFWProperty());
useNativeOpenALPane.selectedProperty().unbindBidirectional(lastVersionSetting.useNativeOpenALProperty());
FXUtils.unbindEnum(cboLauncherVisibility);
@@ -670,7 +687,9 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
noGameCheckPane.selectedProperty().bindBidirectional(versionSetting.notCheckGameProperty());
noJVMCheckPane.selectedProperty().bindBidirectional(versionSetting.notCheckJVMProperty());
noJVMArgsPane.selectedProperty().bindBidirectional(versionSetting.noJVMArgsProperty());
noNativesPatchPane.selectedProperty().bindBidirectional(versionSetting.notPatchNativesProperty());
showLogsPane.selectedProperty().bindBidirectional(versionSetting.showLogsProperty());
useSoftwareRenderer.selectedProperty().bindBidirectional(versionSetting.useSoftwareRendererProperty());
useNativeGLFWPane.selectedProperty().bindBidirectional(versionSetting.useNativeGLFWProperty());
useNativeOpenALPane.selectedProperty().bindBidirectional(versionSetting.useNativeOpenALProperty());
FXUtils.bindEnum(cboLauncherVisibility, versionSetting.launcherVisibilityProperty());
@@ -0,0 +1,553 @@
package org.jackhuang.hmcl.ui.versions;
import com.github.steveice10.opennbt.tag.builtin.*;
import com.jfoenix.controls.JFXComboBox;
import com.jfoenix.controls.JFXTextField;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import org.jackhuang.hmcl.game.World;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.construct.ComponentList;
import org.jackhuang.hmcl.ui.construct.DoubleValidator;
import org.jackhuang.hmcl.ui.construct.NumberValidator;
import org.jackhuang.hmcl.ui.construct.OptionToggleButton;
import org.jackhuang.hmcl.ui.decorator.DecoratorPage;
import org.jackhuang.hmcl.util.i18n.Locales;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
import java.util.logging.Level;
import static org.jackhuang.hmcl.util.Logging.LOG;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
public final class WorldInfoPage extends StackPane implements DecoratorPage {
private final World world;
private final CompoundTag levelDat;
private final CompoundTag dataTag;
private final ObjectProperty<State> stateProperty = new SimpleObjectProperty<>();
public WorldInfoPage(World world) throws IOException {
this.world = world;
this.levelDat = world.readLevelDat();
this.dataTag = levelDat.get("Data");
CompoundTag worldGenSettings = dataTag.get("WorldGenSettings");
stateProperty.set(State.fromTitle(i18n("world.info.title", world.getWorldName())));
ScrollPane scrollPane = new ScrollPane();
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
getChildren().setAll(scrollPane);
VBox rootPane = new VBox();
rootPane.setFillWidth(true);
scrollPane.setContent(rootPane);
FXUtils.smoothScrolling(scrollPane);
rootPane.getStyleClass().add("card-list");
ComponentList basicInfo = new ComponentList();
{
BorderPane worldNamePane = new BorderPane();
{
Label label = new Label(i18n("world.name"));
worldNamePane.setLeft(label);
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
Label worldNameLabel = new Label();
worldNameLabel.setText(world.getWorldName());
BorderPane.setAlignment(worldNameLabel, Pos.CENTER_RIGHT);
worldNamePane.setRight(worldNameLabel);
}
BorderPane gameVersionPane = new BorderPane();
{
Label label = new Label(i18n("world.info.game_version"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
gameVersionPane.setLeft(label);
Label gameVersionLabel = new Label();
gameVersionLabel.setText(world.getGameVersion());
BorderPane.setAlignment(gameVersionLabel, Pos.CENTER_RIGHT);
gameVersionPane.setRight(gameVersionLabel);
}
BorderPane randomSeedPane = new BorderPane();
{
Label label = new Label(i18n("world.info.random_seed"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
randomSeedPane.setLeft(label);
Label randomSeedLabel = new Label();
BorderPane.setAlignment(randomSeedLabel, Pos.CENTER_RIGHT);
randomSeedPane.setRight(randomSeedLabel);
Tag tag = worldGenSettings != null ? worldGenSettings.get("seed") : dataTag.get("RandomSeed");
if (tag instanceof LongTag) {
randomSeedLabel.setText(tag.getValue().toString());
}
}
BorderPane lastPlayedPane = new BorderPane();
{
Label label = new Label(i18n("world.info.last_played"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
lastPlayedPane.setLeft(label);
Label lastPlayedLabel = new Label();
lastPlayedLabel.setText(Locales.SIMPLE_DATE_FORMAT.get().format(new Date(world.getLastPlayed())));
BorderPane.setAlignment(lastPlayedLabel, Pos.CENTER_RIGHT);
lastPlayedPane.setRight(lastPlayedLabel);
}
BorderPane timePane = new BorderPane();
{
Label label = new Label(i18n("world.info.time"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
timePane.setLeft(label);
Label timeLabel = new Label();
BorderPane.setAlignment(timeLabel, Pos.CENTER_RIGHT);
timePane.setRight(timeLabel);
Tag tag = dataTag.get("Time");
if (tag instanceof LongTag) {
long days = ((LongTag) tag).getValue() / 24000;
timeLabel.setText(i18n("world.info.time.format", days));
}
}
OptionToggleButton allowCheatsButton = new OptionToggleButton();
{
allowCheatsButton.setTitle(i18n("world.info.allow_cheats"));
Tag tag = dataTag.get("allowCommands");
if (tag instanceof ByteTag) {
ByteTag byteTag = (ByteTag) tag;
byte value = byteTag.getValue();
if (value == 0 || value == 1) {
allowCheatsButton.setSelected(value == 1);
allowCheatsButton.selectedProperty().addListener((o, oldValue, newValue) -> {
byteTag.setValue(newValue ? (byte) 1 : (byte) 0);
saveLevelDat();
});
} else {
allowCheatsButton.setDisable(true);
}
} else {
allowCheatsButton.setDisable(true);
}
}
OptionToggleButton generateFeaturesButton = new OptionToggleButton();
{
generateFeaturesButton.setTitle(i18n("world.info.generate_features"));
Tag tag = worldGenSettings != null ? worldGenSettings.get("generate_features") : dataTag.get("MapFeatures");
if (tag instanceof ByteTag) {
ByteTag byteTag = (ByteTag) tag;
byte value = byteTag.getValue();
if (value == 0 || value == 1) {
generateFeaturesButton.setSelected(value == 1);
generateFeaturesButton.selectedProperty().addListener((o, oldValue, newValue) -> {
byteTag.setValue(newValue ? (byte) 1 : (byte) 0);
saveLevelDat();
});
} else {
generateFeaturesButton.setDisable(true);
}
} else {
generateFeaturesButton.setDisable(true);
}
}
BorderPane difficultyPane = new BorderPane();
{
Label label = new Label(i18n("world.info.difficulty"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
difficultyPane.setLeft(label);
JFXComboBox<Difficulty> difficultyBox = new JFXComboBox<>(Difficulty.items);
BorderPane.setAlignment(difficultyBox, Pos.CENTER_RIGHT);
difficultyPane.setRight(difficultyBox);
Tag tag = dataTag.get("Difficulty");
if (tag instanceof ByteTag) {
ByteTag byteTag = (ByteTag) tag;
Difficulty difficulty = Difficulty.of(byteTag.getValue());
if (difficulty != null) {
difficultyBox.setValue(difficulty);
difficultyBox.valueProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
byteTag.setValue((byte) newValue.ordinal());
saveLevelDat();
}
});
} else {
difficultyBox.setDisable(true);
}
} else {
difficultyBox.setDisable(true);
}
}
basicInfo.getContent().setAll(
worldNamePane, gameVersionPane, randomSeedPane, lastPlayedPane, timePane,
allowCheatsButton, generateFeaturesButton, difficultyPane);
rootPane.getChildren().addAll(ComponentList.createComponentListTitle(i18n("world.info.basic")), basicInfo);
}
Tag playerTag = dataTag.get("Player");
if (playerTag instanceof CompoundTag) {
CompoundTag player = (CompoundTag) playerTag;
ComponentList playerInfo = new ComponentList();
BorderPane locationPane = new BorderPane();
{
Label label = new Label(i18n("world.info.player.location"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
locationPane.setLeft(label);
Label locationLabel = new Label();
BorderPane.setAlignment(locationLabel, Pos.CENTER_RIGHT);
locationPane.setRight(locationLabel);
Dimension dim = Dimension.of(player.get("Dimension"));
if (dim != null) {
String posString = dim.formatPosition(player.get("Pos"));
if (posString != null)
locationLabel.setText(posString);
}
}
BorderPane lastDeathLocationPane = new BorderPane();
{
Label label = new Label(i18n("world.info.player.last_death_location"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
lastDeathLocationPane.setLeft(label);
Label lastDeathLocationLabel = new Label();
BorderPane.setAlignment(lastDeathLocationLabel, Pos.CENTER_RIGHT);
lastDeathLocationPane.setRight(lastDeathLocationLabel);
Tag tag = player.get("LastDeathLocation");
if (tag instanceof CompoundTag) {
Dimension dim = Dimension.of(((CompoundTag) tag).get("dimension"));
if (dim != null) {
String posString = dim.formatPosition(((CompoundTag) tag).get("pos"));
if (posString != null)
lastDeathLocationLabel.setText(posString);
}
}
}
BorderPane spawnPane = new BorderPane();
{
Label label = new Label(i18n("world.info.player.spawn"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
spawnPane.setLeft(label);
Label spawnLabel = new Label();
BorderPane.setAlignment(spawnLabel, Pos.CENTER_RIGHT);
spawnPane.setRight(spawnLabel);
Dimension dim = Dimension.of(player.get("SpawnDimension"));
if (dim != null) {
Tag x = player.get("SpawnX");
Tag y = player.get("SpawnY");
Tag z = player.get("SpawnZ");
if (x instanceof IntTag && y instanceof IntTag && z instanceof IntTag)
spawnLabel.setText(dim.formatPosition(((IntTag) x).getValue(), ((IntTag) y).getValue(), ((IntTag) z).getValue()));
}
}
BorderPane playerGameTypePane = new BorderPane();
{
Label label = new Label(i18n("world.info.player.game_type"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
playerGameTypePane.setLeft(label);
JFXComboBox<GameType> gameTypeBox = new JFXComboBox<>(GameType.items);
BorderPane.setAlignment(gameTypeBox, Pos.CENTER_RIGHT);
playerGameTypePane.setRight(gameTypeBox);
Tag tag = player.get("playerGameType");
if (tag instanceof IntTag) {
IntTag intTag = (IntTag) tag;
GameType gameType = GameType.of(intTag.getValue());
if (gameType != null) {
gameTypeBox.setValue(gameType);
gameTypeBox.valueProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
intTag.setValue(newValue.ordinal());
saveLevelDat();
}
});
} else {
gameTypeBox.setDisable(true);
}
} else {
gameTypeBox.setDisable(true);
}
}
BorderPane healthPane = new BorderPane();
{
Label label = new Label(i18n("world.info.player.health"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
healthPane.setLeft(label);
JFXTextField healthField = new JFXTextField();
healthField.setPrefWidth(50);
healthField.setAlignment(Pos.CENTER_RIGHT);
BorderPane.setAlignment(healthField, Pos.CENTER_RIGHT);
healthPane.setRight(healthField);
Tag tag = player.get("Health");
if (tag instanceof FloatTag) {
FloatTag floatTag = (FloatTag) tag;
healthField.setText(new DecimalFormat("#").format(floatTag.getValue().floatValue()));
healthField.textProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
try {
floatTag.setValue(Float.parseFloat(newValue));
saveLevelDat();
} catch (Throwable ignored) {
}
}
});
FXUtils.setValidateWhileTextChanged(healthField, true);
healthField.setValidators(new DoubleValidator(i18n("input.number"), true));
} else {
healthField.setDisable(true);
}
}
BorderPane foodLevelPane = new BorderPane();
{
Label label = new Label(i18n("world.info.player.food_level"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
foodLevelPane.setLeft(label);
JFXTextField foodLevelField = new JFXTextField();
foodLevelField.setPrefWidth(50);
foodLevelField.setAlignment(Pos.CENTER_RIGHT);
BorderPane.setAlignment(foodLevelField, Pos.CENTER_RIGHT);
foodLevelPane.setRight(foodLevelField);
Tag tag = player.get("foodLevel");
if (tag instanceof IntTag) {
IntTag intTag = (IntTag) tag;
foodLevelField.setText(String.valueOf(intTag.getValue()));
foodLevelField.textProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
try {
intTag.setValue(Integer.parseInt(newValue));
saveLevelDat();
} catch (Throwable ignored) {
}
}
});
FXUtils.setValidateWhileTextChanged(foodLevelField, true);
foodLevelField.setValidators(new NumberValidator(i18n("input.number"), true));
} else {
foodLevelField.setDisable(true);
}
}
BorderPane xpLevelPane = new BorderPane();
{
Label label = new Label(i18n("world.info.player.xp_level"));
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
xpLevelPane.setLeft(label);
JFXTextField xpLevelField = new JFXTextField();
xpLevelField.setPrefWidth(50);
xpLevelField.setAlignment(Pos.CENTER_RIGHT);
BorderPane.setAlignment(xpLevelField, Pos.CENTER_RIGHT);
xpLevelPane.setRight(xpLevelField);
Tag tag = player.get("XpLevel");
if (tag instanceof IntTag) {
IntTag intTag = (IntTag) tag;
xpLevelField.setText(String.valueOf(intTag.getValue()));
xpLevelField.textProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
try {
intTag.setValue(Integer.parseInt(newValue));
saveLevelDat();
} catch (Throwable ignored) {
}
}
});
FXUtils.setValidateWhileTextChanged(xpLevelField, true);
xpLevelField.setValidators(new NumberValidator(i18n("input.number"), true));
} else {
xpLevelField.setDisable(true);
}
}
playerInfo.getContent().setAll(
locationPane, lastDeathLocationPane, spawnPane,
playerGameTypePane, healthPane, foodLevelPane, xpLevelPane
);
rootPane.getChildren().addAll(ComponentList.createComponentListTitle(i18n("world.info.player")), playerInfo);
}
}
private void saveLevelDat() {
LOG.info("Saving level.dat of world " + world.getWorldName());
try {
this.world.writeLevelDat(levelDat);
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to save level.dat of world " + world.getWorldName(), e);
}
}
@Override
public ReadOnlyObjectProperty<State> stateProperty() {
return stateProperty;
}
private static final class Dimension {
static final Dimension OVERWORLD = new Dimension(null);
static final Dimension THE_NETHER = new Dimension(i18n("world.info.dimension.the_nether"));
static final Dimension THE_END = new Dimension(i18n("world.info.dimension.the_end"));
final String name;
static Dimension of(Tag tag) {
if (tag instanceof IntTag) {
switch (((IntTag) tag).getValue()) {
case 0:
return OVERWORLD;
case 1:
return THE_NETHER;
case 2:
return THE_END;
default:
return null;
}
} else if (tag instanceof StringTag) {
String id = ((StringTag) tag).getValue();
switch (id) {
case "overworld":
case "minecraft:overworld":
return OVERWORLD;
case "the_nether":
case "minecraft:the_nether":
return THE_NETHER;
case "the_end":
case "minecraft:the_end":
return THE_END;
default:
return new Dimension(id);
}
} else {
return null;
}
}
private Dimension(String name) {
this.name = name;
}
String formatPosition(Tag tag) {
if (tag instanceof ListTag) {
ListTag listTag = (ListTag) tag;
if (listTag.size() != 3)
return null;
Tag x = listTag.get(0);
Tag y = listTag.get(1);
Tag z = listTag.get(2);
if (x instanceof DoubleTag && y instanceof DoubleTag && z instanceof DoubleTag) {
//noinspection MalformedFormatString
return this == OVERWORLD
? String.format("(%.2f, %.2f, %.2f)", x.getValue(), y.getValue(), z.getValue())
: String.format("%s (%.2f, %.2f, %.2f)", name, x.getValue(), y.getValue(), z.getValue());
}
return null;
}
if (tag instanceof IntArrayTag) {
IntArrayTag intArrayTag = (IntArrayTag) tag;
int x = intArrayTag.getValue(0);
int y = intArrayTag.getValue(1);
int z = intArrayTag.getValue(2);
return this == OVERWORLD
? String.format("(%d, %d, %d)", x, y, z)
: String.format("%s (%d, %d, %d)", name, x, y, z);
}
return null;
}
String formatPosition(int x, int y, int z) {
return this == OVERWORLD
? String.format("(%d, %d, %d)", x, y, z)
: String.format("%s (%d, %d, %d)", name, x, y, z);
}
String formatPosition(double x, double y, double z) {
return this == OVERWORLD
? String.format("(%.2f, %.2f, %.2f)", x, y, z)
: String.format("%s (%.2f, %.2f, %.2f)", name, x, y, z);
}
}
private enum Difficulty {
PEACEFUL, EASY, NORMAL, HARD;
static final ObservableList<Difficulty> items = FXCollections.observableList(Arrays.asList(values()));
static Difficulty of(int d) {
return d >= 0 && d <= items.size() ? items.get(d) : null;
}
@Override
public String toString() {
return i18n("world.info.difficulty." + name().toLowerCase(Locale.ROOT));
}
}
private enum GameType {
SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR;
static final ObservableList<GameType> items = FXCollections.observableList(Arrays.asList(values()));
static GameType of(int d) {
return d >= 0 && d <= items.size() ? items.get(d) : null;
}
@Override
public String toString() {
return i18n("world.info.player.game_type." + name().toLowerCase(Locale.ROOT));
}
}
}
@@ -50,6 +50,8 @@ public class WorldListItem extends Control {
title.set(parseColorEscapes(world.getWorldName()));
subtitle.set(i18n("world.description", world.getFileName(), Locales.SIMPLE_DATE_FORMAT.get().format(new Date(world.getLastPlayed())), world.getGameVersion() == null ? i18n("message.unknown") : world.getGameVersion()));
setOnMouseClicked(event -> showInfo());
}
@Override
@@ -99,4 +101,12 @@ public class WorldListItem extends Control {
}
Controllers.navigate(new DatapackListPage(world.getWorldName(), world.getFile()));
}
public void showInfo() {
try {
Controllers.navigate(new WorldInfoPage(world));
} catch (Exception e) {
// TODO
}
}
}
@@ -43,7 +43,9 @@ final class ExecutableHeaderHelper {
private ExecutableHeaderHelper() {}
private static Map<String, String> suffix2header = mapOf(
pair("exe", "assets/HMCLauncher.exe"));
pair("exe", "assets/HMCLauncher.exe"),
pair("sh", "assets/HMCLauncher.sh")
);
private static Optional<String> getSuffix(Path file) {
String filename = file.getFileName().toString();
@@ -47,6 +47,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
pair("javafx.fxml.LoadException", i18n("crash.NoClassDefFound")),
pair("Location is not set", i18n("crash.NoClassDefFound")),
pair("UnsatisfiedLinkError", i18n("crash.user_fault")),
pair("java.time.zone.ZoneRulesException: Unable to load TZDB time-zone rules", i18n("crash.user_fault")),
pair("java.lang.NoClassDefFoundError", i18n("crash.NoClassDefFound")),
pair("org.jackhuang.hmcl.util.ResourceNotFoundError", i18n("crash.NoClassDefFound")),
pair("java.lang.VerifyError", i18n("crash.NoClassDefFound")),
@@ -0,0 +1,114 @@
package org.jackhuang.hmcl.util;
import com.google.gson.reflect.TypeToken;
import org.jackhuang.hmcl.game.Library;
import org.jackhuang.hmcl.game.NativesDirectoryType;
import org.jackhuang.hmcl.game.Version;
import org.jackhuang.hmcl.setting.VersionSetting;
import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.platform.Architecture;
import org.jackhuang.hmcl.util.platform.JavaVersion;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import org.jackhuang.hmcl.util.versioning.VersionNumber;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.*;
import java.util.logging.Level;
import static org.jackhuang.hmcl.util.Logging.LOG;
public final class NativePatcher {
private NativePatcher() {
}
private static final Library NONEXISTENT_LIBRARY = new Library(null);
public static Version patchNative(Version version, String gameVersion, JavaVersion javaVersion, VersionSetting settings) {
if (settings.isNotPatchNatives())
return version;
if (settings.getNativesDirType() == NativesDirectoryType.CUSTOM) {
if (gameVersion != null && VersionNumber.VERSION_COMPARATOR.compare(gameVersion, "1.19") < 0)
return version;
ArrayList<Library> newLibraries = new ArrayList<>();
for (Library library : version.getLibraries()) {
if (!library.appliesToCurrentEnvironment())
continue;
if (library.getClassifier() == null
|| !library.getArtifactId().startsWith("lwjgl")
|| !library.getClassifier().startsWith("natives")) {
newLibraries.add(library);
}
}
return version.setLibraries(newLibraries);
}
if (javaVersion.getArchitecture().isX86())
return version;
if (javaVersion.getPlatform().getOperatingSystem() == OperatingSystem.OSX
&& javaVersion.getArchitecture() == Architecture.ARM64
&& gameVersion != null
&& VersionNumber.VERSION_COMPARATOR.compare(gameVersion, "1.19") >= 0)
return version;
Map<String, Library> replacements = Hole.nativeReplacement.get(javaVersion.getPlatform().toString());
if (replacements == null) {
LOG.warning("No alternative native library provided for platform " + javaVersion.getPlatform());
return version;
}
ArrayList<Library> newLibraries = new ArrayList<>();
for (Library library : version.getLibraries()) {
if (!library.appliesToCurrentEnvironment())
continue;
if (library.isNative()) {
Library replacement = replacements.getOrDefault(library.getName() + ":natives", NONEXISTENT_LIBRARY);
if (replacement == NONEXISTENT_LIBRARY) {
if (!(settings.isUseNativeGLFW() && library.getArtifactId().contains("glfw"))
&& !(settings.isUseNativeOpenAL() && library.getArtifactId().contains("openal"))) {
LOG.warning("No alternative native library " + library.getName() + " provided for platform " + javaVersion.getPlatform());
return version;
}
newLibraries.add(library);
} else if (replacement != null) {
newLibraries.add(replacement);
}
} else {
Library replacement = replacements.getOrDefault(library.getName(), NONEXISTENT_LIBRARY);
if (replacement == NONEXISTENT_LIBRARY) {
newLibraries.add(library);
} else if (replacement != null) {
newLibraries.add(replacement);
}
}
}
return version.setLibraries(newLibraries);
}
public static Library getSoftwareRendererLoader(JavaVersion javaVersion) {
Map<String, Library> map = Hole.nativeReplacement.get(javaVersion.getPlatform().toString());
return map != null ? map.get("software-renderer-loader") : null;
}
private static final class Hole {
static Map<String, Map<String, Library>> nativeReplacement;
static {
//noinspection ConstantConditions
try (Reader reader = new InputStreamReader(NativePatcher.class.getResourceAsStream("/assets/natives.json"))) {
nativeReplacement = JsonUtils.GSON.fromJson(reader, new TypeToken<Map<String, Map<String, Library>>>() {
}.getType());
} catch (IOException e) {
nativeReplacement = Collections.emptyMap();
LOG.log(Level.WARNING, "Failed to load native library list", e);
}
}
}
}
Binary file not shown.
@@ -0,0 +1,183 @@
#!/usr/bin/env bash
set -e
# Switch message language
if [ -z "${LANG##zh_*}" ]; then
_HMCL_USE_CHINESE=true
else
_HMCL_USE_CHINESE=false
fi
# _HMCL_OS
case "$OSTYPE" in
linux*)
_HMCL_OS="linux";;
darwin*)
_HMCL_OS="osx";;
msys*|cygwin*)
_HMCL_OS="windows";;
*)
_HMCL_OS="unknown";;
esac
# Normalize _HMCL_ARCH
case "$(uname -m)" in
x86_64|x86-64|amd64|em64t|x64)
_HMCL_ARCH="x86_64";;
x86_32|x86-32|x86|ia32|i386|i486|i586|i686|i86pc|x32)
_HMCL_ARCH="x86";;
arm64|aarch64|armv8*|armv9*)
_HMCL_ARCH="arm64";;
arm|arm32|aarch32|armv7*)
_HMCL_ARCH="arm32";;
loongarch64)
_HMCL_ARCH="loongarch64";;
*)
_HMCL_ARCH="unknown";;
esac
# Self path
_HMCL_PATH="${BASH_SOURCE[0]}"
_HMCL_DIR=$(dirname "$_HMCL_PATH")
if [ "$_HMCL_OS" == "windows" ]; then
_HMCL_JAVA_EXE_NAME="java.exe"
else
_HMCL_JAVA_EXE_NAME="java"
fi
# _HMCL_VM_OPTIONS
if [ -n "${HMCL_JAVA_OPTS+x}" ]; then
_HMCL_VM_OPTIONS=${HMCL_JAVA_OPTS}
else
_HMCL_VM_OPTIONS="-XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=15"
fi
# First, find Java in HMCL_JAVA_HOME
if [ -n "${HMCL_JAVA_HOME+x}" ]; then
if [ -x "$HMCL_JAVA_HOME/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$HMCL_JAVA_HOME/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
else
if [ "$_HMCL_USE_CHINESE" == true ]; then
echo "环境变量 HMCL_JAVA_HOME 的值无效,请设置为合法的 Java 路径。" 1>&2
else
echo "The value of the environment variable HMCL_JAVA_HOME is invalid, please set it to a valid Java path." 1>&2
fi
exit 1
fi
fi
# Find Java in HMCL_DIR
case "$_HMCL_ARCH" in
x86_64)
if [ -x "$_HMCL_DIR/jre-x64/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$_HMCL_DIR/jre-x64/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
if [ -x "$_HMCL_DIR/jre-x86/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$_HMCL_DIR/jre-x86/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
;;
x86)
if [ -x "$_HMCL_DIR/jre-x86/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$_HMCL_DIR/jre-x86/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
;;
arm64)
if [ -x "$_HMCL_DIR/jre-arm64/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$_HMCL_DIR/jre-arm64/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
;;
arm32)
if [ -x "$_HMCL_DIR/jre-arm32/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$_HMCL_DIR/jre-arm32/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
;;
loongarch64)
if [ -x "$_HMCL_DIR/jre-loongarch64/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$_HMCL_DIR/jre-loongarch64/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
;;
esac
# Find Java in JAVA_HOME
if [ -f "$JAVA_HOME/bin/$_HMCL_JAVA_EXE_NAME" ]; then
"$JAVA_HOME/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
# Find Java in PATH
if [ -x "$(command -v $_HMCL_JAVA_EXE_NAME)" ]; then
$_HMCL_JAVA_EXE_NAME $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
exit 0
fi
# Java not found
if [[ "$_HMCL_OS" == "unknown" || "$_HMCL_ARCH" == "unknown" ]]; then
if [ "$_HMCL_USE_CHINESE" == true ]; then
echo "运行 HMCL 需要 Java 运行时环境,请安装 Java 并设置环境变量后重试。" 1>&2
else
echo "The Java runtime environment is required to run HMCL. " 1>&2
echo "Please install Java and set the environment variables and try again." 1>&2
fi
exit 1
fi
if [[ "$_HMCL_ARCH" == "loongarch64" ]]; then
if [ "$_HMCL_USE_CHINESE" == true ]; then
echo "运行 HMCL 需要 Java 运行时环境,请安装龙芯 JDK8 (http://www.loongnix.cn/zh/api/java/downloads-jdk8/index.html) 并设置环境变量后重试。" 1>&2
else
echo "The Java runtime environment is required to run HMCL." 1>&2
echo "Please install Loongson JDK8 (http://www.loongnix.cn/zh/api/java/downloads-jdk8/index.html) and set the environment variables, then try again." 1>&2
fi
exit 1
fi
case "$_HMCL_OS" in
linux)
_HMCL_DOWNLOAD_PAGE_OS="&os=Linux";;
osx)
_HMCL_DOWNLOAD_PAGE_OS="&os=macOS";;
windows)
_HMCL_DOWNLOAD_PAGE_OS="&os=Windows";;
*)
echo "Unknown os: $_HMCL_OS" 1>&2
exit 1
;;
esac
case "$_HMCL_ARCH" in
arm64)
_HMCL_DOWNLOAD_PAGE_ARCH="&bitness=64-bit&architecture=ARM";;
arm32)
_HMCL_DOWNLOAD_PAGE_ARCH="&bitness=32-bit&architecture=ARM";;
x86_64)
_HMCL_DOWNLOAD_PAGE_ARCH="&bitness=64-bit&architecture=x86";;
x86)
_HMCL_DOWNLOAD_PAGE_ARCH="&bitness=32-bit&architecture=x86";;
*)
echo "Unknown architecture: $_HMCL_ARCH" 1>&2
exit 1
;;
esac
_HMCL_DOWNLOAD_PAGE="https://bell-sw.com/pages/downloads/?version=java-17-lts$_HMCL_DOWNLOAD_PAGE_OS$_HMCL_DOWNLOAD_PAGE_ARCH&package=jdk-full"
if [ "$_HMCL_USE_CHINESE" == true ]; then
echo "运行 HMCL 需要 Java 运行时环境,请安装 Java 并设置环境变量后重试。" 1>&2
echo "$_HMCL_DOWNLOAD_PAGE" 1>&2
else
echo "The Java runtime environment is required to run HMCL. " 1>&2
echo "Please install Java and set the environment variables and try again." 1>&2
echo "$_HMCL_DOWNLOAD_PAGE" 1>&2
fi
exit 1
@@ -315,6 +315,33 @@
-fx-cursor: hand;
}
.installer-item {
-fx-padding: 8px;
}
.installer-item:list-item {
-fx-border-color: #e0e0e0;
-fx-border-width: 0 0 1 0;
-fx-alignment: center-left;
}
.installer-item:list-item > .installer-item-name {
-fx-pref-width: 80px;
}
.installer-item:list-item > .installer-item-status {
-fx-max-width: infinity;
}
.installer-item:card {
-fx-background-color: white;
-fx-background-radius: 4;
-fx-alignment: center;
-fx-pref-width: 180px;
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.26), 10, 0.12, -1, 2);
}
/*******************************************************************************
* *
* Main Page *
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -27,8 +27,8 @@ about.claim.statement=テキスト全体のリンクをクリックします。
about.community=コミュニティ
about.community.discord=Discord
about.community.discord.statement=チャットに参加しよう!
about.community.kaiheila=KaiHeiLa
about.community.kaiheila.statement=チャットに参加しよう!
about.community.kookapp=KOOK
about.community.kookapp.statement=チャットに参加しよう!
about.dependency=Dependencies
about.legal=法的承認
about.thanks_to=Thanks to
@@ -88,6 +88,7 @@ account.register=登録
account.manage=アカウントリスト
account.methods=ログインタイプ
account.methods.authlib_injector=authlib-インジェクター
account.methods.little_skin=Little Skin
account.methods.microsoft=Microsoft Account
account.methods.microsoft.birth=誕生日の設定を編集する方法...
account.methods.microsoft.deauthorize=アカウントのバインドを解除
@@ -443,6 +444,8 @@ install.installer.install_online.tooltip=Fabric、Forge、OptiFine、LiteLoader
install.installer.liteloader=LiteLoader
install.installer.not_installed=インストールされていません
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.version=%s
install.modpack=modpackを導入
install.new_game=新規作成
@@ -470,7 +473,6 @@ launch.advice.not_enough_space=割り当てたメモリが多すぎます。物
launch.advice.require_newer_java_version=Minecraft %1$s にはJava %2$s 以降が必要です。今すぐダウンロードしますか?
launch.advice.too_large_memory_for_32bit=32ビットJavaランタイム環境が原因で、割り当てたメモリが多すぎるため、ゲームがクラッシュする可能性があります。 32ビットシステムの最大メモリ容量は1024MBです。打ち上げを続けましょうか。
launch.advice.vanilla_linux_java_8=Linux x86-64の場合、Minecraft1.12.2以下はJava8でのみ実行できます。\nJava9以降のバージョンでは、liblwjgl.soなどの32ビットネイティブライブラリをロードできません。
launch.advice.vanilla_x86=Minecraftは現在、x86およびx86-64以外のアーキテクチャの公式サポートを提供していません。\nプラットフォームの対応するネイティブライブラリをダウンロードして、その配置パスを指定してみてください。
launch.advice.vanilla_x86.translation=Minecraftは現在、x86およびx86-64以外のアーキテクチャの公式サポートを提供していません。\nJava for x86-64を使用して、トランスレータを介してminecraftを実行するか、プラットフォームの対応するネイティブライブラリをダウンロードして指定してくださいその配置パス。
launch.failed=起動できません
launch.failed.cannot_create_jvm=Java仮想マシンを作成できませんでした。 Java引数は問題を引き起こす可能性があります。 JVM引数なしで再起動してください。
@@ -582,8 +584,8 @@ modpack.task.install.error=このmodpackファイルは認識できません。
modpack.task.install.will=modpackをインストールします:
modpack.type.curse=Curse
modpack.type.curse.completion=Cursemodpackに関連するファイルをインストールします
modpack.type.curse.tolerable_error=このCursemodpackのすべてのファイルのダウンロードを完了できません。対応するゲームバージョンを開始するときに、ダウンロードを再試行できます。ネットワークの問題により、数回再試行する場合があります。
modpack.type.curse.error=このCursemodpackをインストールできません。再試行してください。
modpack.type.curse.tolerable_error=このmodpackのすべてのファイルのダウンロードを完了できません。対応するゲームバージョンを開始するときに、ダウンロードを再試行できます。ネットワークの問題により、数回再試行する場合があります。
modpack.type.curse.error=このmodpackをインストールできません。再試行してください。
modpack.type.curse.not_found=必要なリソースの一部が欠落しているため、ダウンロードできませんでした。最新バージョンまたは他のmodpackを検討してください。
modpack.type.manual.warning=このmodpackをインポートする代わりに、おそらくこのmodpackファイルを直接解凍する必要があります。そして、バンドルされたランチャーを使用してゲームを起動します。このmodpackは、ランチャーによってエクスポートされるのではなく、.minecraftディレクトリを圧縮することによって手動で作成されます。 HMCLはこのmodpackのインポートを試みることができます、続行しますか?
modpack.type.mcbbs=MCBBS標準
@@ -817,7 +819,9 @@ settings.advanced.java_permanent_generation_space=PermGen Space / MB
settings.advanced.java_permanent_generation_space.prompt=Java 8以降のメタスペース、MB
settings.advanced.jvm=Java仮想マシンの設定
settings.advanced.jvm_args=JavaVM引数
settings.advanced.jvm_args.prompt=ここに入力して、デフォルト設定を上書きします
settings.advanced.jvm_args.prompt=- 入力パラメータがデフォルトパラメータと同じである場合、追加されません\n\
- GCパラメータを入力すると、デフォルトパラメータのG1パラメータが無効になります\n\
- 追加時にデフォルトの引数を追加しない場合は、下の[デフォルトのJVM引数を追加しない]をクリックしてください
settings.advanced.launcher_visibility.close=ゲームの起動時にランチャーを閉じます。
settings.advanced.launcher_visibility.hide=ゲームの起動時にランチャーを非表示にします。
settings.advanced.launcher_visibility.hide_and_reopen=ランチャーを非表示にし、ゲームが終了したら再度開きます。
@@ -937,13 +941,13 @@ update.changelog=変更
update.channel.dev=ベータ
update.channel.dev.hint=ベータ版を使用しています。ベータ版には、リリースバージョンと比較していくつかの追加機能が含まれている可能性があり、テストにのみ使用されます。\n \
ベータ版は不安定なはずです!\n \
問題が発生した場合は、<a href="hmcl://settings/feedback">フィードバックページ</a>にアクセスして報告するか、チャット<a href="https://discord.gg/jVvC7HfM6U">Discord</a>または<a href="https://kaihei.co/Kx7n3t">KaiHeiLa</a>で問題を報告します。\n \n \
問題が発生した場合は、<a href="hmcl://settings/feedback">フィードバックページ</a>にアクセスして報告するか、チャット<a href="https://discord.gg/jVvC7HfM6U">Discord</a>または<a href="https://kook.top/Kx7n3t">KOOK</a>で問題を報告します。\n \n \
このヒントを非表示にするには、<a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">寄付</a>するか、フィードバックに貢献をする必要があります。
update.channel.dev.title=ベータ版のヒント
update.channel.nightly=アルファ
update.channel.nightly.hint=アルファ版を使用しています。これには、ベータ版およびリリース版と比較していくつかの追加機能が含まれている可能性があり、テストにのみ使用されます。\n \
アルファ版は不安定です!\n \
問題が発生した場合は、<a href="hmcl://settings/feedback">フィードバックページ</a>にアクセスして報告するか、チャット<a href="https://discord.gg/jVvC7HfM6U">Discord</a>または<a href="https://kaihei.co/Kx7n3t">KaiHeiLa</a>で問題を報告します。\n \n \
問題が発生した場合は、<a href="hmcl://settings/feedback">フィードバックページ</a>にアクセスして報告するか、チャット<a href="https://discord.gg/jVvC7HfM6U">Discord</a>または<a href="https://kook.top/Kx7n3t">KOOK</a>で問題を報告します。\n \n \
このヒントを非表示にするには、<a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">寄付</a>するか、フィードバックに印象的な貢献をする必要があります。
update.channel.nightly.title=アルファ版のヒント
update.channel.stable=リリース
@@ -27,8 +27,8 @@ about.claim.statement=Кликните на ссылку, чтобы увиде
about.community=Сообщество
about.community.discord=Discord
about.community.discord.statement=Присоединиться!
about.community.kaiheila=KaiHeiLa
about.community.kaiheila.statement=Присоединиться!
about.community.kookapp=KOOK
about.community.kookapp.statement=Присоединиться!
about.dependency=Зависимости
about.legal=Юридическое подтверждение
about.thanks_to=Отдельная благодарность
@@ -88,6 +88,7 @@ account.register=Регистрация
account.manage=Список аккаунтов
account.methods=Метод авторизации
account.methods.authlib_injector=authlib-injector
account.methods.little_skin=Little Skin
account.methods.microsoft=Аккаунт Microsoft
account.methods.microsoft.birth=Как изменить настройки дня рождения...
account.methods.microsoft.deauthorize=Отменить авторизацию аккаунта
@@ -445,6 +446,8 @@ install.installer.install_online.tooltip=Поддержка установки F
install.installer.liteloader=LiteLoader
install.installer.not_installed=Не установлен
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.version=%s
install.modpack=Установить модпак
install.new_game=Установить новую игру
@@ -474,7 +477,6 @@ launch.advice.require_newer_java_version=Minecraft %1$s требует Java %2$s
launch.advice.too_large_memory_for_32bit=Вы выделили слишком много памяти, из-за 32-разрядной Java Runtime Environment ваша игра может рухнуть. Максимальный объем памяти для 32-разрядных систем составляет 1024 МБ. Продолжить запуск?
launch.advice.vanilla_linux_java_8=На Linux x86-64, Minecraft 1.12.2 и ниже может работать только на Java 8.\nВерсии Java 9 и выше не могут загружать 32-битные нативные библиотеки, такие как liblwjgl.so.
launch.advice.modlauncher8=Используемая вами версия Forge несовместима с текущей версией Java. Попробуйте обновить Forge или начните с Java 8u312/11.0.13/17.0.1 или более ранней версии. Продолжить запуск?
launch.advice.vanilla_x86=В настоящее время Minecraft не обеспечивает официальную поддержку архитектур, отличных от x86 и x86-64.\nВы можете попробовать скачать соответствующую нативную библиотеку платформы и указать её путь размещения.
launch.advice.vanilla_x86.translation=В настоящее время Minecraft не обеспечивает официальную поддержку архитектур, отличных от x86 и x86-64.\nПожалуйста, используйте Java для x86-64 для запуска minecraft через переводчик, или загрузите соответствующую нативную библиотеку платформы и укажите её путь размещения.
launch.failed=Невозможно запустить
launch.failed.cannot_create_jvm=Не удалось создать виртуальную машину Java. Аргументы Java могут вызвать проблемы. Перезапустите без аргументов JVM.
@@ -586,8 +588,8 @@ modpack.task.install.error=Этот файл модпака не может бы
modpack.task.install.will=Установить модпак:
modpack.type.curse=Curse
modpack.type.curse.completion=Установите файлы, связанные с модпаком Curse
modpack.type.curse.tolerable_error=Мы не можем завершить скачивание всех файлов этого модпака Curse. Вы можете повторить скачивание при запуске соответствующей версии игры. Вы можете повторить попытку несколько раз из-за проблем с сетью.
modpack.type.curse.error=Невозможно установить этот модпак Curse. Повторите ещё раз.
modpack.type.curse.tolerable_error=Мы не можем завершить скачивание всех файлов этого модпака. Вы можете повторить скачивание при запуске соответствующей версии игры. Вы можете повторить попытку несколько раз из-за проблем с сетью.
modpack.type.curse.error=Невозможно установить этот модпак. Повторите ещё раз.
modpack.type.curse.not_found=Некоторые из необходимых ресурсов отсутствуют и поэтому не могут быть загружены. Скачайте последнюю версию или другие модпаки.
modpack.type.manual.warning=Возможно, вам нужно напрямую распаковать файл этого модпака, а не импортировать его. И запустите игру с помощью прилагаемого лаунчера. Этот модпак создаётся вручную путем сжатия директории .minecraft, а не экспортируется лаунчером. HMCL может попытаться импортировать этот модпак, продолжать?
modpack.type.mcbbs=Стандарт MCBBS
@@ -821,7 +823,9 @@ settings.advanced.java_permanent_generation_space=PermGen места/МБ
settings.advanced.java_permanent_generation_space.prompt=Метапространство на Java 8 и выше, МБ
settings.advanced.jvm=Параметры Java VM
settings.advanced.jvm_args=Аргументы Java VM
settings.advanced.jvm_args.prompt=Заполните здесь, чтобы переопределить настройки по умолчанию
settings.advanced.jvm_args.prompt=- Если входной параметр совпадает с параметром по умолчанию, он не будет добавлен\n\
- Введите любые параметры GC, параметр G1 параметра по умолчанию будет отключен\n\
- Нажмите «Отсутствие аргументов JVM по умолчанию» ниже, чтобы не добавлять аргументы по умолчанию при добавлении.
settings.advanced.launcher_visibility.close=Закрывать лаунчер при запуске игры
settings.advanced.launcher_visibility.hide=Сворачивать лаунчер при запуске игры
settings.advanced.launcher_visibility.hide_and_reopen=Сворачивать лаунчер при запуске игры и вновь открывать после закрытия игры
@@ -942,13 +946,13 @@ update.changelog=Изменения
update.channel.dev=Бета
update.channel.dev.hint=Вы используете бета-версию, которая может включать некоторые дополнительные функции по сравнению с релизной версией, используемой только для тестирования.\n\
Бета-версия может быть нестабильной!\n\
Если вы встретили какие-то проблемы, вы можете зайти на <a href="hmcl://settings/feedback">страницу обратной связи</a>, чтобы сообщить о них, или присоединиться к чату <a href="https://discord.gg/jVvC7HfM6U">Discord</a> или <a href="https://kaihei.co/Kx7n3t">KaiHeiLa</a>, чтобы сообщить о проблемах.\n\n\
Если вы встретили какие-то проблемы, вы можете зайти на <a href="hmcl://settings/feedback">страницу обратной связи</a>, чтобы сообщить о них, или присоединиться к чату <a href="https://discord.gg/jVvC7HfM6U">Discord</a> или <a href="https://kook.top/Kx7n3t">KOOK</a>, чтобы сообщить о проблемах.\n\n\
Чтобы скрыть эту подсказку, нужно <a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">пожертвовать</a> или сделать внушительный вклад через обратную связь.
update.channel.dev.title=Подсказки для бета-версии
update.channel.nightly=Альфа
update.channel.nightly.hint=Вы используете альфа-версию, которая может включать некоторые дополнительные функциональные возможности по сравнению с бета-версией и версией релиза, используемой только для тестирования.\n\
Альфа-версия может быть нестабильной!\n\
Если вы встретили какие-то проблемы, вы можете зайти на <a href="hmcl://settings/feedback">страницу обратной связи</a>, чтобы сообщить о них, или присоединиться к чату <a href="https://discord.gg/jVvC7HfM6U">Discord</a> или <a href="https://kaihei.co/Kx7n3t">KaiHeiLa</a>, чтобы сообщить о проблемах.\n\n\
Если вы встретили какие-то проблемы, вы можете зайти на <a href="hmcl://settings/feedback">страницу обратной связи</a>, чтобы сообщить о них, или присоединиться к чату <a href="https://discord.gg/jVvC7HfM6U">Discord</a> или <a href="https://kook.top/Kx7n3t">KOOK</a>, чтобы сообщить о проблемах.\n\n\
Чтобы скрыть эту подсказку, нужно <a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">пожертвовать</a> или сделать внушительный вклад через обратную связь.
update.channel.nightly.title=Подсказки для альфа-версии
update.channel.stable=Релиз
@@ -27,18 +27,18 @@ about.claim.statement=點擊連結以查看全文
about.community=社區
about.community.discord=Discord
about.community.discord.statement=歡迎加入 Discord 討論區,加入後請遵守討論區規定
about.community.kaiheila=開黑啦
about.community.kaiheila.statement=歡迎加入開黑啦討論區,加入後請遵守討論區規定
about.community.kookapp=KOOK
about.community.kookapp.statement=歡迎加入 KOOK 討論區,加入後請遵守討論區規定
about.dependency=相依元件
about.legal=法律聲明
about.thanks_to=鳴謝
about.thanks_to.bangbang93.statement=提供 BMCLAPI 下載源,請贊助支持 BMCLAPI!
about.thanks_to.bangbang93.statement=提供 BMCLAPI 下載地點,請贊助支持 BMCLAPI!
about.thanks_to.contributors=所有通過 Issues、Pull Requests 等管道參與本項目的貢獻者
about.thanks_to.contributors.statement=沒有開源社區的支持,Hello Minecraft! Launcher 無法走到今天
about.thanks_to.gamerteam.statement=提供預設背景圖
about.thanks_to.glavo.statement=為 HMCL 貢獻許多技術支持
about.thanks_to.mcbbs=MCBBS 我的世界中文論壇
about.thanks_to.mcbbs.statement=提供 MCBBS 下載源
about.thanks_to.mcbbs.statement=提供 MCBBS 下載地點
about.thanks_to.mcmod=MC 百科
about.thanks_to.mcmod.statement=提供 Mod 中文名映射表與 Mod 百科
about.thanks_to.noin=阿貓 (mcer.cn)
@@ -76,6 +76,7 @@ account.hmcl.hint=你需要點擊“登入”按鈕,並在打開的網頁中
account.injector.add=新增認證伺服器
account.injector.empty=無 (按一下右側 + 加入)
account.injector.http=警告: 此伺服器使用不安全的 HTTP 協定,您的密碼在登入時會被明文傳輸。
account.injector.link.homepage=首頁
account.injector.link.register=註冊
account.injector.server=認證伺服器
account.injector.server_url=伺服器位址
@@ -88,6 +89,7 @@ account.register=註冊
account.manage=帳戶列表
account.methods=登入方式
account.methods.authlib_injector=authlib-injector 登入
account.methods.little_skin=Little Skin
account.methods.microsoft=微軟帳戶
account.methods.microsoft.birth=如何修改帳戶出生日期
account.methods.microsoft.deauthorize=解除帳戶授權
@@ -102,7 +104,7 @@ account.methods.microsoft.logging_in=登入中...
account.methods.microsoft.hint=你需要按照以下步驟添加:\n1.點擊“登入”按鈕\n2.在網頁瀏覽器顯示的網站中輸入 HMCL 顯示的代碼(自動拷貝,直接粘貼即可),並點擊“下一步”\n3.按照網站的提示登入\n4.當網站顯示“ 是否允許此應用訪問你的信息?”的標識時,請點擊“是”\n5.當網站提示“大功告成”的標示時,及表示登入成功!然後等待賬戶完成添加即可!\n-若網站提示“出现错误”的標識,請嘗試重新按照以上步驟登入\n-若賬戶添加失敗,請嘗試重新按照以上步驟登入\n<b>-若設備網絡環境不佳,可能登陸網站加載很慢甚至無法加載,此時請使用 VPN 或代理伺服器並重試</b>\n-若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期
account.methods.microsoft.manual=你需要按照以下步驟添加:\n1.點擊“登入”按鈕\n2.在網頁瀏覽器顯示的網站中輸入該代碼:<b>%1$s</b>(已自動拷貝,請點此再次拷貝),並點擊“下一步”\n3.按照網站的提示登入\n4.當網站顯示“ 是否允許此應用訪問你的信息?”的標識時,請點擊“是”\n5.當網站提示“大功告成”的標示時,及表示登入成功!然後等待賬戶完成添加即可\n-若網站提示“出现错误”的標識,請嘗試重新按照以上步驟登入\n-若賬戶添加失敗,請嘗試重新按照以上步驟登入\n-若網站未能打開,請手動在網頁瀏覽器中打開:%2$s\n<b>-若設備網絡環境不佳,可能登陸網站加載很慢甚至無法加載,此時請使用 VPN 或代理伺服器並重試</b>\n-若登入微軟賬號的 Token 洩露,可點擊下方“解除帳戶授權”解除登入授權,然後等待 Token 過期
account.methods.microsoft.profile=帳戶設置頁
account.methods.microsoft.snapshot=HMCL 快照版不支持微软登录
account.methods.microsoft.snapshot=HMCL 快照版暫不提供微軟登入支持,請使用穩定版或測試版進行登入。
account.methods.microsoft.waiting_browser=等待在新打開的瀏覽器窗口中完成登入...
account.methods.offline=離線模式
account.methods.offline.uuid=UUID
@@ -184,7 +186,7 @@ curse.category.4479=高難度
curse.category.4482=大型模組包
curse.category.4472=科技
curse.category.4473=魔法
curse.category.5128=香草+
curse.category.5128=原版增強
# https://addons-ecs.forgesvc.net/api/v2/category/section/6
curse.category.5299=教育
@@ -298,13 +300,14 @@ download.provider.mojang=官方伺服器 (OptiFine 自動安裝的下載來源
download.provider.official=儘量使用官方源(最新,但可能加載慢)
download.provider.balanced=選擇加載速度快的下載源(平衡,但可能不是最新)
download.provider.mirror=儘量使用鏡像源(加載快,但可能不是最新)
download.java=下載 Java
download.javafx=正在下載必要的運行時組件
download.javafx.notes=正在通過網絡下載 HMCL 必要的運行時組件。\n點擊“切換下載源”按鈕查看詳情以及選擇下載源,點擊“取消”按鈕停止並退出。\n注意:如果下載速度過慢,請嘗試切换下載源。
download.javafx.component=正在下載模塊 %s
download.javafx.prepare=準備開始下載
exception.access_denied=因為無法訪問文件 %s,HMCL 沒有對該文件的訪問權限,或者該文件被其他程序打開。\n\
請你檢查當前操作系統帳戶是否能訪問該文件,比如非管理員用戶可能不能訪問其他帳戶的個人文件夾內的文件。\n\
exception.access_denied=因為無法存取檔案 %s,HMCL 沒有對該文件的訪問權限,或者該文件被其他程序打開。\n\
請你檢查當前操作系統帳戶是否能訪存取檔案,比如非管理員用戶可能不能訪問其他帳戶的個人資料夾內的文件。\n\
對於 Windows 用戶,你還可以嘗試通過資源監視器查看是否有程序占用了該文件,如果是,你可以關閉占用此文件相關程序,或者重啟電腦再試。
exception.artifact_malformed=下載的文件正確,無法通過校驗。
exception.ssl_handshake=無法建立 SSL 連接,因為當前 Java 虛擬機缺少相關的 SSL 證書。你可以嘗試使用其他的 Java 虛擬機啟動 HMCL 再試。
@@ -316,6 +319,7 @@ extension.ps1=PowerShell 指令碼
extension.sh=Bash 指令碼
fatal.javafx.incompatible=缺少 JavaFX 運行環境。\nHMCL 無法在低於 Java 11 且缺少 JavaFX 的 Java 環境上自行補全 JavaFX 運行環境。\n請更換如 Oracle Java 8 等包含 JavaFX 的 Java 運行環境,或者更新到 Java 11 或更高版本。
fatal.javafx.incompatible.loongson=缺少 JavaFX 運行環境。\n請使龍芯 JDK 8 (http://www.loongnix.cn/zh/api/java/downloads-jdk8/index.html) 啟動 HMCL。
fatal.javafx.missing=找不到 JavaFX。\n如果您使用的是 Java 11 或更高版本,請降級到 Oracle JRE 8,或者安裝 BellSoft Liberica Full JRE。\n如果您使用的是其他 OpenJDK 构建,請確保其包含 OpenJFX。
fatal.missing_dst_root_ca_x3=目前的 Java 平台缺少 DST Root CA X3 憑證。\n您依然可以使用 Hello Minecraft! Launcher,但會無法連線到部分網站 (如使用 Lets Encrypt 憑證的站台),這可能會使 Hello Minecraft! Launcher 無法正常運作。\n請將您的 Java 升級到 8u101 以上來解決此問題。
fatal.config_loading_failure=Hello Minecraft! Launcher 無法載入設定檔案。\n請確保 Hello Minecraft! Launcher 對 "%s" 目錄及該目錄下的檔案擁有讀寫權限。
@@ -323,6 +327,7 @@ fatal.migration_requires_manual_reboot=Hello Minecraft! Launcher 即將升級完
fatal.apply_update_failure=我們很抱歉 Hello Minecraft! Launcher 無法自動完成升級程式,因為出現了一些問題。\n但你依然可以從 %s 處手動下載 Hello Minecraft! Launcher 來完成升級。\n請考慮向我們回報該問題。
fatal.samba=如果您正在通過 Samba 共亯的資料夾中運行 HMCL,HMCL 可能無法正常工作,請嘗試更新您的 Java 或在本地資料夾內運行 HMCL。
fatal.illegal_char=您的用戶資料夾路徑中存在非法字元‘=’。HMCL 能够運行,但一些功能無法正常使用。 \n您將無法使用外置登入帳戶以及離線登入更換皮膚功能,並且在進行多人遊戲時可能存在更大的安全隱患。
fatal.unsupported_platform=Minecraft 尚未你您的平臺提供完善支持,所以可能影響遊戲體驗或無法啟動遊戲。\n若無法啟動 Minecraft 1.17 及以上版本,可以嘗試在版本設定中打開“使用 OpenGL 軟渲染器”選項,\n使用 CPU 渲染以獲得更好的相容性。
feedback=回饋
feedback.add=新增回饋
@@ -376,10 +381,10 @@ game.crash.reason.fabric_warnings=Fabric 提供了一些警告訊息:\n%1$s
game.crash.reason.file_already_exists=當前遊戲因為文件 %1$s 已經存在,無法繼續運行。\n如果你認為這個文件可以刪除,你可以在備份這個文件後嘗試刪除它,並重新啟動遊戲。
game.crash.reason.file_changed=當前遊戲因為檔案校驗失敗,無法繼續運行。\n如果你手動修改了 Minecraft.jar 檔案,你需要回退修改,或者重新下載遊戲。
game.crash.reason.gl_operation_failure=當前遊戲因為你使用的某些 Mod、光影包、材質包,無法繼續運行。\n請先嘗試禁用你所使用的Mod/光影包/材質包再試。
game.crash.reason.graphics_driver=當前遊戲因為你的顯示卡驅動存在問題崩潰了。\n\
請嘗試升級你的顯示卡驅動到最新版本後再嘗試啟動遊戲。\n\
game.crash.reason.graphics_driver=當前遊戲因為你的顯示卡驅動存在問題崩潰了,請嘗試升級你的顯示卡驅動到最新版本後再嘗試啟動遊戲。\n\
如果你的電腦存在獨立顯示卡,你需要檢查遊戲是否使用集成/核芯顯示卡啟動。如果是,請嘗試使用獨立顯示卡啟動 HMCL 與遊戲。如果仍有問題,你可能需要考慮換一個新顯示卡或新電腦。\n\
如果你確實需要使用核芯顯示卡,請檢查你的電腦的 CPU 是否是 Intel(R) Core(TM) 3000 系列或更舊的處理器,如果是,對於 Minecraft 1.16.5 及更舊版本,請你將遊戲所使用的 Java 版本降級至 1.8.0_51 及以下版本,否則你必須更換獨立顯示卡或新電腦。\n\
如果你確實需要使用核芯顯示卡,請檢查你的電腦的 CPU 是否是 Intel(R) Core(TM) 3000 系列或更舊的處理器,如果是,對於 Minecraft 1.16.5 及更舊版本,請你將遊戲所使用的 Java 版本降級至 1.8.0_51 及以下版本,否則你需要更換獨立顯示卡或新電腦。\n\
在版本設定中打開“使用 OpenGL 軟渲染器”選項也可以解决此問題,但打開此選項後在 CPU 效能不足的情况下幀數會顯著降低,僅推薦以調試為目的或應急時開啟。\n\
詳情請點擊 <a href="https://hmcl.huangyuhui.net/help/game/graphics-card">此處</a> 查看
game.crash.reason.illegal_access_error=當前遊戲因為某些 Mod 的問題,無法繼續運行。\n如果你認識:%1$s,你可以更新或刪除對應 Mod 再試。
game.crash.reason.jdk_9=當前遊戲因為 Java 版本過高,無法繼續運行。\n你需要下載安裝 Java 8,並在遊戲設置中將 Java 設置為 1.8 的版本。
@@ -449,6 +454,8 @@ install.installer.install_online.tooltip=支援安裝 Fabric、Forge、OptiFine
install.installer.liteloader=LiteLoader
install.installer.not_installed=不安裝
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.version=%s
install.modpack=安裝模組包
install.new_game=安裝新遊戲版本
@@ -477,9 +484,8 @@ launch.advice.newer_java=偵測到您未使用 Java 8 及更新版本,Java 8
launch.advice.not_enough_space=您設定的記憶體大小過大,由於超過了系統記憶體大小 %dMB,所以可能影響遊戲體驗或無法啟動遊戲。是否繼續啟動?
launch.advice.require_newer_java_version=Minecraft %1$s 僅能運行在 Java %2$s 或更高版本上,但 HMCL 未能找到該 Java 版本,你可以點擊“是” ,HMCL 會自動下載他,是否下載?
launch.advice.too_large_memory_for_32bit=您設定的記憶體大小過大,由於可能超過了 32 位元 Java 的記憶體分配限制,所以可能無法啟動遊戲,請將記憶體調至低於 1024MB 的值。是否繼續啟動?
launch.advice.vanilla_linux_java_8=對於 Linux x86-64 平台,Minecraft 1.12.2 及以下版本僅支持 Java 8。\nJava 9+ 版本會無法載入 32 位的 liblwjgl.so。
launch.advice.vanilla_x86=Minecraft 官方尚未提供對非 x86-64 平臺的支持。\n您可以嘗試下載您所用平臺對應的本機庫,在遊戲設定的調試選項中指定其路徑後再嘗試運行。
launch.advice.vanilla_x86.translation=你的電腦中沒有安裝 X64 架構的 Java 虛擬機(JDK),你可以在 <a href="https://docs.microsoft.com/zh-tw/java/openjdk/download"> 這裡 </a> 下載 <b> X64 </b> 架構的 Java 虛擬機。\nMinecraft 尚未提供對 ARM 平台的支持,不能在您目前使用的 ARM64 架構 JDK 上運行。因此 HMCL 會借助 Rosetta 2 轉譯執行 X64 架構的 JDK 來啟動 Minecraft。
launch.advice.vanilla_linux_java_8=對於 Linux x86-64 平台,Minecraft 1.12.2 及以下版本僅支援 Java 8。\nJava 9+ 版本會無法載入 32 位的 liblwjgl.so。
launch.advice.vanilla_x86.translation=Minecraft 尚未為您的平臺提供完善支持,所以可能影響遊戲體驗或無法啟動遊戲。\n你可以在 <a href="https://docs.microsoft.com/java/openjdk/download"> 這裡 </a>下載<b> X86-64 </b> 架構的 Java 以獲得更完整的體驗。\n是否繼續啟動?
launch.failed=啟動失敗
launch.failed.cannot_create_jvm=偵測到無法建立 Java 虛擬機,可能是 Java 參數有問題。可以在設定中開啟無參數模式啟動。
launch.failed.creating_process=啟動失敗,在建立新處理程式時發生錯誤。可能是 Java 路徑錯誤。
@@ -491,7 +497,7 @@ launch.failed.execution_policy=設定執行策略
launch.failed.execution_policy.failed_to_set=設定執行策略失敗
launch.failed.execution_policy.hint=當前執行策略封锁您執行 PowerShell 腳本。\n點擊“確定”允許當前用戶執行本地 PowerShell 腳本,或點擊“取消”保持現狀。
launch.failed.exited_abnormally=遊戲非正常退出,請查看記錄檔案,或聯絡他人尋求幫助。
launch.failed.no_accepted_java=找不到適合當前遊戲使用的 Java。如果您認為實際存在合適的 Java,您可以在遊戲設置中手動設置 Java。
launch.failed.no_accepted_java=找不到適合當前遊戲使用的 Java,是否使用默認 Java 啟動遊戲?點擊“是”使用默認 Java 繼續啟動遊戲,\n或者請到遊戲設定中選擇一個合適的Java虛擬機器版本。
launch.state.dependencies=處理遊戲相依元件
launch.state.done=啟動完成
launch.state.java=檢測 Java 版本
@@ -590,8 +596,8 @@ modpack.task.install=匯入模組包
modpack.task.install.error=無法識別該模組包,目前僅支援匯入 Curse、Modrinth、MultiMC、HMCL 模組包。
modpack.task.install.will=將會安裝模組包:
modpack.type.curse=Curse
modpack.type.curse.tolerable_error=但未能完成 Curse 模組包檔案的下載,您可以在啟動該遊戲版本時繼續 Curse 模組包檔案的下載。由於網路問題,您可能需要重試多次。
modpack.type.curse.error=無法完成 Curse 模組包的下載,請多次重試或設定代理
modpack.type.curse.tolerable_error=但未能完成該模組包檔案的下載,您可以在啟動該遊戲版本時繼續該模組包檔案的下載。由於網路問題,您可能需要重試多次……
modpack.type.curse.error=無法完成該模組包所需的依賴下載,請多次重試或設定代理……
modpack.type.curse.not_found=部分必需檔案已經從網路中被刪除並且再也無法下載,請嘗試該模組包的最新版本或者安裝其他模組包。
modpack.type.manual.warning=您大概需要直接解压该模組包,并使用其自带的启动器即可开始游戏,而不需要导入模組包。该模組包不是由启动器导出的模組包,而是人工打包 .minecraft 资料夹而来的,这类模組包通常附带游戏启动器。HMCL 可以尝试导入该模組包,但不保证可用性,是否继续?
modpack.type.mcbbs=我的世界中文論壇模組包標準
@@ -619,17 +625,23 @@ modpack.wizard.step.initialization.warning=在製作模組包前,請您確認
modpack.wizard.step.initialization.server=點選此處查看有關伺服器自動更新模組包的製作教學
modrinth.category.adventure=冒險
modrinth.category.challenging=高難度
modrinth.category.combat=戰鬥
modrinth.category.cursed=Cursed
modrinth.category.decoration=裝飾
modrinth.category.equipment=裝備
modrinth.category.fabric=Fabric
modrinth.category.food=食物
modrinth.category.forge=Forge
modrinth.category.kitchen-sink=大雜燴
modrinth.category.library=支持庫
modrinth.category.lightweight=輕量
modrinth.category.magic=魔法
modrinth.category.misc=其他
modrinth.category.modloader=Modloader
modrinth.category.multiplayer=多人
modrinth.category.optimization=最佳化
modrinth.category.quests=任務
modrinth.category.quilt=Quilt
modrinth.category.rift=Rift
modrinth.category.storage=儲存
@@ -644,8 +656,8 @@ mods.add.success=成功新增模組 %s。
mods.category=類別
mods.check_updates=檢查模組更新
mods.check_updates.current_version=當前版本
mods.check_updates.failed=部分文件下載失敗
mods.check_updates.file=文件
mods.check_updates.failed=部分檔案下載失敗
mods.check_updates.file=檔案
mods.check_updates.source=來源
mods.check_updates.target_version=目標版本
mods.check_updates.update=更新
@@ -670,7 +682,7 @@ mods.url=官方頁面
multiplayer=多人聯機
multiplayer.agreement.prompt=使用多人聯機功能前,你需要先同意多人聯機服務提供方 ioi 系列作品的用戶協議與免責聲明。\n用戶使用聯機服務的行為,將被視為無條件同意該用戶協議與免責聲明。
multiplayer.download=正在下載相依元件
multiplayer.download.failed=初始化失敗,部分文件未能完成下載
multiplayer.download.failed=初始化失敗,部分檔案未能完成下載
multiplayer.download.success=多人聯機初始化完成
multiplayer.download.unsupported=多人聯機依賴不支持當前系統或平台
multiplayer.exit.after_ready=多人聯機會話意外退出,退出碼 %d
@@ -771,6 +783,34 @@ world.import.already_exists=此世界已經存在
world.import.choose=選擇要匯入的存檔壓縮檔
world.import.failed=無法匯入此世界: %s
world.import.invalid=無法識別的存檔壓縮包
world.info.title=世界 %s - 世界資訊
world.info.basic=基本資訊
world.info.allow_cheats=允許作弊
world.info.dimension.the_nether=下界
world.info.dimension.the_end=末地
world.info.difficulty=難度
world.info.difficulty.peaceful=和平
world.info.difficulty.easy=簡單
world.info.difficulty.normal=普通
world.info.difficulty.hard=困難
world.info.game_version=遊戲版本
world.info.last_played=上一次遊戲時間
world.info.generate_features=生成建築
world.info.player=玩家資訊
world.info.player.food_level=饑餓值
world.info.player.game_type=遊戲模式
world.info.player.game_type.adventure=極限
world.info.player.game_type.creative=創造
world.info.player.game_type.spectator=旁觀
world.info.player.game_type.survival=生存
world.info.player.health=生命值
world.info.player.last_death_location=上次死亡位置
world.info.player.location=位置
world.info.player.spawn=床/重生錨位置
world.info.player.xp_level=經驗等級
world.info.random_seed=種子
world.info.time=遊戲內時間
world.info.time.format=%s 天
world.game_version=遊戲版本
world.manage=世界/資料包
world.name=世界名稱
@@ -816,7 +856,7 @@ settings.advanced.custom_commands=自訂命令
settings.advanced.custom_commands.hint=自訂命令被調用時將包含如下的環境變數:\n\
\ - $INST_NAME: 版本名稱\n\
\ - $INST_ID: 版本名稱\n\
\ - $INST_DIR: 版本文件夾\n\
\ - $INST_DIR: 版本資料夾\n\
\ - $INST_MC_DIR: 遊戲運行路徑\n\
\ - $INST_JAVA: 遊戲運行使用的 Java 路徑\n\
\ - $INST_FORGE: 若安裝了 Forge,將會存在本環境變數\n\
@@ -825,13 +865,16 @@ settings.advanced.custom_commands.hint=自訂命令被調用時將包含如下
\ - $INST_FABRIC: 若安裝了 Fabric,將會存在本環境變數
settings.advanced.dont_check_game_completeness=不檢查遊戲完整性
settings.advanced.dont_check_jvm_validity=不檢查 JVM 與遊戲的相容性
settings.advanced.dont_patch_natives=不嘗試自動替換本機庫
settings.advanced.game_dir.default=預設(.minecraft/)
settings.advanced.game_dir.independent=各版本獨立(.minecraft/versions/<版本名>/,除 assets、libraries)
settings.advanced.java_permanent_generation_space=記憶體永久儲存區域
settings.advanced.java_permanent_generation_space.prompt=格式: MB
settings.advanced.jvm=Java 虛擬機設定
settings.advanced.jvm_args=Java 虛擬機參數
settings.advanced.jvm_args.prompt=填寫此處可以覆蓋預設設定
settings.advanced.jvm_args.prompt=- 若在“Java 虛擬機參數”中輸入的參數與默認參數相同,則不會添加\n\
- 在“Java 虛擬機參數”輸入任何 GC 參數,默認參數的 G1 參數會禁用\n\
- 點擊下方“不添加默認的 JVM 參數”可在啟動遊戲時不添加默認參數
settings.advanced.launcher_visibility.close=遊戲啟動後結束啟動器
settings.advanced.launcher_visibility.hide=遊戲啟動後隱藏啟動器
settings.advanced.launcher_visibility.hide_and_reopen=隱藏啟動器並在遊戲結束後重新開啟
@@ -859,6 +902,7 @@ settings.advanced.server_ip=伺服器位址
settings.advanced.server_ip.prompt=預設,啟動遊戲後直接進入對應伺服器
settings.advanced.use_native_glfw=[Linux] 使用系統 GLFW
settings.advanced.use_native_openal=[Linux] 使用系統 OpenAL
settings.advanced.use_software_renderer=使用 OpenGL 軟渲染器(相容性更好,但效能較差)
settings.advanced.workaround=除錯選項
settings.advanced.workaround.warning=除錯選項僅提供給專業玩家使用。修改除錯選項可能會導致遊戲無法啟動。除非你知道你在做什麼,否則請你不要修改這些選項。
settings.advanced.wrapper_launcher=前置指令
@@ -952,13 +996,13 @@ update.changelog=更新日誌
update.channel.dev=測試版
update.channel.dev.hint=你正在使用測試版。測試版包含一些未在正式版中包含的測試性功能,僅用於體驗新功能。\n\
測試版功能未受充分驗證,使用起來可能不穩定!\n\
如果你遇到了使用問題,可以在設置的 <a href="hmcl://settings/feedback">回饋頁面</a> 中進行回饋,或加入回饋頁面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kaihei.co/Kx7n3t">開黑啦</a>群以回饋問題。\n\n\
如果你遇到了使用問題,可以在設置的 <a href="hmcl://settings/feedback">回饋頁面</a> 中進行回饋,或加入回饋頁面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kook.top/Kx7n3t">KOOK</a>群以回饋問題。\n\n\
你需要 <a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">贊助</a> 或在回饋過程中作出貢獻以隱藏本提示。
update.channel.dev.title=測試版提示
update.channel.nightly=預覽版
update.channel.nightly.hint=你正在使用預覽版。預覽版可能會每天更新一次,包含一些未在正式版和測試版中包含的測試性功能,僅用於體驗新功能\n\
測試版功能未受充分驗證,使用起來可能不穩定!\n\
如果你遇到了使用問題,可以在設置的 <a href="hmcl://settings/feedback">回饋頁面</a> 中進行回饋,或加入回饋頁面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kaihei.co/Kx7n3t">開黑啦</a>群以回饋問題。\n\n\
如果你遇到了使用問題,可以在設置的 <a href="hmcl://settings/feedback">回饋頁面</a> 中進行回饋,或加入回饋頁面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kook.top/Kx7n3t">KOOK</a>群以回饋問題。\n\n\
你需要 <a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">贊助</a> 或在回饋過程中作出貢獻以隱藏本提示。
update.channel.nightly.title=預覽版提示
update.channel.stable=建議版本
@@ -27,8 +27,8 @@ about.claim.statement=点击链接以查看全文
about.community=社区
about.community.discord=Discord
about.community.discord.statement=欢迎加入 Discord 讨论区,加入后请遵守讨论区规定
about.community.kaiheila=开黑啦
about.community.kaiheila.statement=欢迎加入开黑啦讨论区,加入后请遵守讨论区规定!
about.community.kookapp=KOOK
about.community.kookapp.statement=欢迎加入 KOOK 讨论区,加入后请遵守讨论区规定!
about.dependency=依赖
about.legal=法律声明
about.thanks_to=鸣谢
@@ -76,6 +76,7 @@ account.hmcl.hint=你需要点击“登录”按钮,并在打开的网页中
account.injector.add=添加认证服务器
account.injector.empty=无(点击右侧加号添加)
account.injector.http=警告:此服务器使用不安全的 HTTP 协议,您的密码在登录时会被明文传输!
account.injector.link.homepage=主页
account.injector.link.register=注册
account.injector.server=认证服务器
account.injector.server_url=服务器地址
@@ -88,6 +89,7 @@ account.register=注册
account.manage=帐户列表
account.methods=登录方式
account.methods.authlib_injector=外置登录 (authlib-injector)
account.methods.little_skin=Little Skin
account.methods.microsoft=微软帐户
account.methods.microsoft.birth=如何修改帐户出生日期
account.methods.microsoft.close_page=已完成微软帐户授权,接下来启动器还需要完成剩余登录步骤。你已经可以关闭本页面了。
@@ -102,7 +104,7 @@ account.methods.microsoft.logging_in=登录中……
account.methods.microsoft.hint=你需要按照以下步骤添加:\n1.点击“登录”按钮\n2.在网页浏览器显示的网站中输入 HMCL 显示的代码(自动拷贝,直接粘贴即可),并点击“下一步”\n3.按照网站的提示登录\n4.当网站提示“是否允许此应用访问你的信息?”的标识时,请点击“是”\n5.当网站提示“大功告成”的标识时,及表示登录成功!然后等待账户完成添加即可!\n-若网站提示“出现错误”的标识时,请重新按照以上步骤重新添加\n-若账户添加失败,请重新按照以上步骤重新添加\n<b>-若设备网络环境不佳,可能登录网站加载很慢甚至无法加载,此时请使用 VPN 或代理服务器并重试</b>\n-若登录微软账户的 Token (不是密码)泄露,可点击下方“解除账户绑定”解除登录授权,然后等待 Token 过期
account.methods.microsoft.manual=你需要按照以下步骤添加:\n1.点击“登录”按钮\n2.在网页浏览器显示的网站中输入:<b>%1$s</b>(已自动拷贝,点此再次拷贝),并点击“下一步”\n3.按照网站的提示登录\n4.当网站提示“是否允许此应用访问你的信息?”的标识时,请点击“是”\n5.当网站提示“大功告成”的标识时,及表示登录成功!然后等待账户完成添加即可\n-若网站提示“出现错误”的标识时,请重新按照以上步骤重新添加\n-若账户添加失败,请重新按照以上步骤重新添加\n-若网站未能显示,请手动在网页浏览器中打开:%2$s\n<b>-若设备网络环境不佳,可能登录网站加载很慢甚至无法加载,此时请使用 VPN 或代理服务器并重试</b>\n-若登录微软账户的 Token (不是密码)泄露,可点击下方“解除账户绑定”解除登录授权,然后等待 Token 过期
account.methods.microsoft.profile=帐户设置页
account.methods.microsoft.snapshot=HMCL 快照版不支持微软登录
account.methods.microsoft.snapshot=HMCL 快照版暂不提供微软登录支持,请使用稳定版或测试版进行登录。
account.methods.microsoft.waiting_browser=等待在新打开的浏览器窗口中完成登录……
account.methods.offline=离线模式
account.methods.offline.uuid=UUID
@@ -184,7 +186,7 @@ curse.category.4479=高难度
curse.category.4482=大型整合包
curse.category.4472=科技
curse.category.4473=魔法
curse.category.5128=香草+
curse.category.5128=原版增强
# https://addons-ecs.forgesvc.net/api/v2/category/section/6
curse.category.5299=教育
@@ -298,6 +300,7 @@ download.provider.mojang=官方(OptiFine 自动安装使用 BMCLAPI 下载源
download.provider.official=尽量使用官方源(最新,但可能加载慢)
download.provider.balanced=选择加载速度快的下载源(平衡,但可能不是最新)
download.provider.mirror=尽量使用镜像源(加载快,但可能不是最新)
download.java=下载 Java
download.javafx=正在下载必要的运行时组件……
download.javafx.notes=正在通过网络下载 HMCL 必要的运行时组件。\n点击“切换下载源”按钮查看详情以及选择下载源,点击“取消”按钮停止并退出。\n注意:若下载速度过慢,请尝试切换下载源
download.javafx.component=正在下载模块 %s
@@ -316,6 +319,7 @@ extension.ps1=PowerShell 脚本
extension.sh=Bash 脚本
fatal.javafx.incompatible=缺少 JavaFX 运行环境。\nHMCL 无法在低于 Java 11 且缺少 JavaFX 的 Java 环境上自行补全 JavaFX 运行环境。\n请更换如 Oracle Java 8 等包含 JavaFX 的 Java 运行环境,或者更新到 Java 11 或更高版本。
fatal.javafx.incompatible.loongson=缺少 JavaFX 运行环境。\n请使用龙芯 JDK 8 (http://www.loongnix.cn/zh/api/java/downloads-jdk8/index.html) 启动 HMCL。
fatal.javafx.missing=缺少 JavaFX 运行环境。\n如果您使用的是 Java 11 或更高版本,请降级到 Oracle JRE 8(java.com),或者安装 BellSoft Liberica Full JRE(bell-sw.com/pages/downloads/?package=jre-full)。\n如果您使用的是其他 OpenJDK 构建,请确保其包含 OpenJFX!
fatal.missing_dst_root_ca_x3=当前 Java 平台缺少 DST Root CA X3 证书。\n您依然可以使用 Hello Minecraft! Launcher,但将无法连接到部分站点(如使用 Lets Encrypt 证书的站点),这可能会使 HMCL 无法正常工作。\n请将您的 Java 升级到 8u101 以上以解决此问题。
fatal.config_loading_failure=Hello Minecraft! Launcher 无法加载配置文件\n请确保 Hello Minecraft! Launcher 对 "%s" 目录及该目录下的文件拥有读写权限!
@@ -323,6 +327,7 @@ fatal.migration_requires_manual_reboot=Hello Minecraft! Launcher 即将完成升
fatal.apply_update_failure=我们很抱歉 Hello Minecraft! Launcher 无法自动完成升级,因为出现了一些问题……\n但你依可以从 %s 处手动下载 Hello Minecraft! Launcher 来完成升级\n请考虑向我们反馈该问题!
fatal.samba=如果您正在通过 Samba 共享的文件夹中运行 HMCL,HMCL 可能无法正常工作,请尝试更新您的 Java 或在本地文件夹内运行 HMCL。
fatal.illegal_char=您的用户文件夹路径中存在非法字符‘=’。HMCL 能够运行,但可能某些功能无法正常使用!\n你将无法使用外置登录账户以及离线登录更换皮肤功能,并且在进行多人游戏时可能存在更大的安全隐患!
fatal.unsupported_platform=Minecraft 尚未为您的平台提供完善支持,所以可能影响游戏体验或无法启动游戏。\n若无法启动 Minecraft 1.17 及以上版本,可以尝试在版本设置中打开“使用 OpenGL 软渲染器”选项,\n使用 CPU 渲染以获得更好的兼容性。
feedback=反馈
feedback.add=新增反馈
@@ -376,10 +381,10 @@ game.crash.reason.fabric_warnings=Fabric 提供了一些警告信息:\n%1$s
game.crash.reason.file_already_exists=当前游戏因为文件 %1$s 已经存在,无法继续运行。\n如果你认为这个文件可以删除,你可以在备份这个文件后尝试删除它,并重新启动游戏。
game.crash.reason.file_changed=当前游戏因为文件校验失败,无法继续运行。\n如果你手动修改了 Minecraft.jar 文件,你需要回退修改,或者重新下载游戏。
game.crash.reason.gl_operation_failure=当前游戏因为你使用的某些 Mod、光影包、材质包,无法继续运行。\n请先尝试禁用你所使用的Mod/光影包/材质包再试。
game.crash.reason.graphics_driver=当前游戏因为你的显卡驱动存在问题崩溃了。\n\
请尝试升级你的显卡驱动到最新版本后再尝试启动游戏。\n\
game.crash.reason.graphics_driver=当前游戏因为你的显卡驱动存在问题崩溃了,请尝试升级你的显卡驱动到最新版本后再尝试启动游戏。\n\
如果你的电脑存在独立显卡,你需要检查游戏是否使用集成/核芯显卡启动。如果是,请尝试使用独立显卡启动 HMCL 与游戏。如果仍有问题,你可能需要考虑换一个新显卡或新电脑……\n\
如果你确实需要使用核芯显卡,请检查你的电脑的 CPU 是否是 Intel(R) Core(TM) 3000 系列或更旧的处理器,如果是,对于 Minecraft 1.16.5 及更旧版本,请你将游戏所使用的 Java 版本降级至 1.8.0_51 及以下版本 <a href="https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html">Java 1.8.0 历史版本</a> ,否则你必须更换独立显卡或新电脑。\n\
如果你确实需要使用核芯显卡,请检查你的电脑的 CPU 是否是 Intel(R) Core(TM) 3000 系列或更旧的处理器,如果是,对于 Minecraft 1.16.5 及更旧版本,请你将游戏所使用的 Java 版本降级至 1.8.0_51 及以下版本 <a href="https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html">Java 1.8.0 历史版本</a> ,否则你需要更换独立显卡或新电脑。\n\
在版本设置中打开“使用 OpenGL 软渲染器”选项也可以解决此问题,但打开此选项后在 CPU 性能不足的情况下帧数会显著降低,仅推荐以调试为目的或应急时开启。\n\
详情请点击 <a href="https://hmcl.huangyuhui.net/help/game/graphics-card">此处</a> 查看
game.crash.reason.illegal_access_error=当前游戏因为某些 Mod 的问题,无法继续运行。\n如果你认识:%1$s,你可以更新或删除对应 Mod 再试……
game.crash.reason.jdk_9=当前游戏因为 Java 版本过高,无法继续运行。\n你需要下载安装 Java 8,并在游戏设置中将 Java 设置为 1.8 的版本。
@@ -449,6 +454,8 @@ install.installer.install_online.tooltip=支持安装 Fabric、Forge、OptiFine
install.installer.liteloader=LiteLoader
install.installer.not_installed=不安装
install.installer.optifine=OptiFine
install.installer.quilt=Quilt
install.installer.quilt-api=Quilt API
install.installer.version=%s
install.modpack=安装整合包
install.new_game=安装新游戏版本
@@ -478,8 +485,7 @@ launch.advice.not_enough_space=您设置的内存大小过大,由于超过了
launch.advice.require_newer_java_version=Minecraft %1$s 仅能运行在 Java %2$s 或更高版本上,但 HMCL 未能找到该 Java 版本,你可以点击“是”,HMCL会自动下载他,是否下载?
launch.advice.too_large_memory_for_32bit=您设置的内存大小过大,由于可能超过了 32 位 Java 的内存分配限制,所以可能无法启动游戏,请将内存调至 1024MB 或更小。是否继续启动?
launch.advice.vanilla_linux_java_8=对于 Linux x86-64 平台,Minecraft 1.12.2 及以下版本仅支持 Java 8。\n请到 java.com 或其他途径下载 Java8!\n(可将 Java 路径选择至“自动选择合适的 Java”,启动时会自动下载该 Java)\nJava 9+ 版本会无法加载 32 位的 liblwjgl.so
launch.advice.vanilla_x86=Minecraft 官方尚未提供对非 x86-64 平台的支持。\n您可以尝试下载您所用平台对应的本机库,在游戏设置的调试选项中指定其路径后再尝试运行。
launch.advice.vanilla_x86.translation=你的电脑中没有安装 X64 架构的 Java 虚拟机(JDK),你可以在 <a href="https://docs.microsoft.com/java/openjdk/download"> 这里 </a> 下载 <b> X64 </b> 架构的 Java 虚拟机。\nMinecraft 尚未提供对 ARM 平台的支持,不能在您目前使用的 ARM64 架构 JDK 上运行。因此 HMCL 会借助 Rosetta 2 转译执行 X64 架构的 JDK 来启动 Minecraft。
launch.advice.vanilla_x86.translation=Minecraft 尚未为您的平台提供完善支持,所以可能影响游戏体验或无法启动游戏。\n你可以在 <a href="https://docs.microsoft.com/java/openjdk/download"> 这里 </a> 下载 <b> X86-64 </b> 架构的 Java 以获得更完整的体验。\n是否继续启动?
launch.failed=启动失败
launch.failed.cannot_create_jvm=截获到无法创建 Java 虚拟机,可能是 Java 参数有问题,可以在设置中开启无参数模式启动。
launch.failed.creating_process=启动失败,在创建新进程时发生错误,可能是 Java 路径错误……
@@ -491,7 +497,7 @@ launch.failed.execution_policy=设置执行策略
launch.failed.execution_policy.failed_to_set=设置执行策略失败
launch.failed.execution_policy.hint=当前执行策略阻止您执行 PowerShell 脚本。\n点击“确定”允许当前用户执行本地 PowerShell 脚本,或点击“取消”保持现状。
launch.failed.exited_abnormally=游戏非正常退出,请查看日志文件,或联系他人寻求帮助。
launch.failed.no_accepted_java=找不到适合当前游戏使用的 Java。如果您认为实际存在合适的 Java,您可以在游戏设置中手动设置 Java。
launch.failed.no_accepted_java=找不到适合当前游戏使用的 Java,是否使用默认 Java 启动游戏?点击“是”使用默认 Java 继续启动游戏,\n或者请到游戏设置中选择一个合适的 Java 虚拟机版本。
launch.state.dependencies=处理游戏依赖
launch.state.done=启动完成
launch.state.java=检测 Java 版本
@@ -590,8 +596,8 @@ modpack.task.install=导入整合包
modpack.task.install.error=无法识别该整合包,目前仅支持导入 Curse、Modrinth、MultiMC、HMCL 整合包。
modpack.task.install.will=将会安装整合包:
modpack.type.curse=Curse
modpack.type.curse.tolerable_error=但未能完成 Curse 整合包所需的依赖下载,您可以在启动该游戏版本时继续 Curse 整合包文件的下载。由于网络问题,您可能需要重试多次……
modpack.type.curse.error=未能完成 Curse 整合包所需的依赖下载,请多次重试或设置代理
modpack.type.curse.tolerable_error=但未能完成该整合包所需的依赖下载,您可以在启动该游戏版本时继续该整合包文件的下载。由于网络问题,您可能需要重试多次……
modpack.type.curse.error=未能完成该整合包所需的依赖下载,请多次重试或设置代理……
modpack.type.curse.not_found=部分必需文件已经在网络中被删除并且再也无法下载,请尝试该整合包的最新版本或者安装其他整合包。
modpack.type.manual.warning=您大概需要直接解压该整合包,并使用其自带的启动器即可开始游戏,而不需要导入整合包!该整合包不是由启动器导出的整合包,而是人工打包 .minecraft 文件夹而来的,这类整合包通常附带游戏启动器。HMCL 可以尝试导入该整合包,但不保证可用性,是否继续?
modpack.type.mcbbs=我的世界中文论坛整合包标准
@@ -619,17 +625,23 @@ modpack.wizard.step.initialization.warning=在制作整合包前,请您确认
modpack.wizard.step.initialization.server=点击此处查看有关服务器自动更新整合包的制作教程
modrinth.category.adventure=冒险
modrinth.category.challenging=高难度
modrinth.category.combat=战斗
modrinth.category.cursed=Cursed
modrinth.category.decoration=装饰
modrinth.category.equipment=装备
modrinth.category.fabric=Fabric
modrinth.category.food=食物
modrinth.category.forge=Forge
modrinth.category.kitchen-sink=大杂烩
modrinth.category.library=支持库
modrinth.category.lightweight=轻量
modrinth.category.magic=魔法
modrinth.category.misc=其他
modrinth.category.modloader=Modloader
modrinth.category.multiplayer=多人
modrinth.category.optimization=优化
modrinth.category.quests=任务
modrinth.category.quilt=Quilt
modrinth.category.rift=Rift
modrinth.category.storage=存储
@@ -772,6 +784,34 @@ world.import.already_exists=此世界已经存在
world.import.choose=选择要导入的存档压缩包
world.import.failed=无法导入此世界:%s
world.import.invalid=无法识别该存档压缩包
world.info.title=世界 %s - 世界信息
world.info.basic=基本信息
world.info.allow_cheats=允许作弊
world.info.dimension.the_nether=下界
world.info.dimension.the_end=末地
world.info.difficulty=难度
world.info.difficulty.peaceful=和平
world.info.difficulty.easy=简单
world.info.difficulty.normal=普通
world.info.difficulty.hard=困难
world.info.game_version=游戏版本
world.info.last_played=上一次游戏时间
world.info.generate_features=生成建筑
world.info.player=玩家信息
world.info.player.food_level=饥饿值
world.info.player.game_type=游戏模式
world.info.player.game_type.adventure=极限
world.info.player.game_type.creative=创造
world.info.player.game_type.spectator=旁观
world.info.player.game_type.survival=生存
world.info.player.health=生命值
world.info.player.last_death_location=上次死亡位置
world.info.player.location=位置
world.info.player.spawn=床/重生锚位置
world.info.player.xp_level=经验等级
world.info.random_seed=种子
world.info.time=游戏内时间
world.info.time.format=%s 天
world.manage=世界/数据包
world.name=世界名称
world.name.enter=输入世界名称
@@ -825,13 +865,16 @@ settings.advanced.custom_commands.hint=自定义命令被调用时将包含如
\ - $INST_FABRIC: 若安装了 Fabric,将会存在本环境变量
settings.advanced.dont_check_game_completeness=不检查游戏完整性
settings.advanced.dont_check_jvm_validity=不检查 JVM 与游戏的兼容性
settings.advanced.dont_patch_natives=不尝试自动替换本地库
settings.advanced.game_dir.default=默认(.minecraft/)
settings.advanced.game_dir.independent=各版本独立(存放在 .minecraft/versions/<版本名>/,除 assets、libraries 外)
settings.advanced.java_permanent_generation_space=内存永久保存区域
settings.advanced.java_permanent_generation_space.prompt=单位 MB
settings.advanced.jvm=Java 虚拟机设置
settings.advanced.jvm_args=Java 虚拟机参数
settings.advanced.jvm_args.prompt=填写此处可以覆盖默认设置
settings.advanced.jvm_args.prompt=- 若在“Java 虚拟机参数”输入的参数与默认参数相同,则不会添加\n\
- 在“Java 虚拟机参数”输入任何 GC 参数,默认参数的 G1 参数会禁用\n\
- 点击下方“不添加默认的 JVM 参数”可在启动游戏时不添加默认参数
settings.advanced.launcher_visibility.close=游戏启动后结束启动器
settings.advanced.launcher_visibility.hide=游戏启动后隐藏启动器
settings.advanced.launcher_visibility.hide_and_reopen=隐藏启动器并在游戏结束后重新打开
@@ -859,6 +902,7 @@ settings.advanced.server_ip=服务器地址
settings.advanced.server_ip.prompt=默认,启动游戏后可以直接进入对应服务器
settings.advanced.use_native_glfw=[Linux] 使用系统 GLFW
settings.advanced.use_native_openal=[Linux] 使用系统 OpenAL
settings.advanced.use_software_renderer=使用 OpenGL 软渲染器(兼容性更好,但性能较差)
settings.advanced.workaround=调试选项
settings.advanced.workaround.warning=调试选项仅提供给专业玩家使用。调试选项可能会导致游戏无法启动。除非你知道你在做什么,否则请你不要修改这些选项!
settings.advanced.wrapper_launcher=包装命令
@@ -952,13 +996,13 @@ update.changelog=更新日志
update.channel.dev=测试版
update.channel.dev.hint=你正在使用测试版。测试版包含一些未在正式版中包含的测试性功能,仅用于体验新功能。\n\
测试版功能未受充分验证,使用起来可能不稳定!<a href="https://hmcl.huangyuhui.net/download">下载稳定版</a>\n\
如果你遇到了使用问题,可以在设置的 <a href="hmcl://settings/feedback">反馈页面</a> 中进行反馈,或加入反馈页面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kaihei.co/Kx7n3t">开黑啦</a>群以反馈问题。欢迎关注 B 站账号 <a href="https://space.bilibili.com/1445341">huanghongxun</a> 以关注 HMCL 的开发进展。\n\n\
如果你遇到了使用问题,可以在设置的 <a href="hmcl://settings/feedback">反馈页面</a> 中进行反馈,或加入反馈页面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kook.top/Kx7n3t">KOOK</a>群以反馈问题。欢迎关注 B 站账号 <a href="https://space.bilibili.com/1445341">huanghongxun</a> 以关注 HMCL 的开发进展。\n\n\
你需要 <a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">赞助</a> 或在反馈过程中作出贡献以隐藏本提示。
update.channel.dev.title=测试版提示
update.channel.nightly=预览版
update.channel.nightly.hint=你正在使用预览版。预览版可能会每天更新一次,包含一些未在正式版和测试版中包含的测试性功能,仅用于体验新功能。\n\
测试版功能未受充分验证,使用起来可能不稳定!<a href="https://hmcl.huangyuhui.net/download">下载稳定版</a>\n\
如果你遇到了使用问题,可以在设置的 <a href="hmcl://settings/feedback">反馈页面</a> 中进行反馈,或加入反馈页面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kaihei.co/Kx7n3t">开黑啦</a>群以反馈问题。欢迎关注 B 站账号 <a href="https://space.bilibili.com/1445341">huanghongxun</a> 以关注 HMCL 的开发进展。\n\n\
如果你遇到了使用问题,可以在设置的 <a href="hmcl://settings/feedback">反馈页面</a> 中进行反馈,或加入反馈页面中提供的 <a href="https://discord.gg/jVvC7HfM6U">Discord</a> 或 <a href="https://kook.top/Kx7n3t">KOOK</a>群以反馈问题。欢迎关注 B 站账号 <a href="https://space.bilibili.com/1445341">huanghongxun</a> 以关注 HMCL 的开发进展。\n\n\
你需要 <a href="https://hmcl.huangyuhui.net/api/redirect/sponsor">赞助</a> 或在反馈过程中作出贡献以隐藏本提示。
update.channel.nightly.title=预览版提示
update.channel.stable=推荐版本
File diff suppressed because it is too large. Load diff
@@ -33,8 +33,8 @@ import java.util.function.Function;
import static org.jackhuang.hmcl.util.Lang.tryCast;
public class AuthlibInjectorAccountFactory extends AccountFactory<AuthlibInjectorAccount> {
private AuthlibInjectorArtifactProvider downloader;
private Function<String, AuthlibInjectorServer> serverLookup;
private final AuthlibInjectorArtifactProvider downloader;
private final Function<String, AuthlibInjectorServer> serverLookup;
/**
* @param serverLookup a function that looks up {@link AuthlibInjectorServer} by url
@@ -64,14 +64,17 @@ public class AuthlibInjectorAccountFactory extends AccountFactory<AuthlibInjecto
public AuthlibInjectorAccount fromStorage(Map<Object, Object> storage) {
Objects.requireNonNull(storage);
String apiRoot = tryCast(storage.get("serverBaseURL"), String.class)
.orElseThrow(() -> new IllegalArgumentException("storage does not have API root."));
AuthlibInjectorServer server = serverLookup.apply(apiRoot);
return fromStorage(storage, downloader, server);
}
static AuthlibInjectorAccount fromStorage(Map<Object, Object> storage, AuthlibInjectorArtifactProvider downloader, AuthlibInjectorServer server) {
YggdrasilSession session = YggdrasilSession.fromStorage(storage);
String username = tryCast(storage.get("username"), String.class)
.orElseThrow(() -> new IllegalArgumentException("storage does not have username"));
String apiRoot = tryCast(storage.get("serverBaseURL"), String.class)
.orElseThrow(() -> new IllegalArgumentException("storage does not have API root."));
AuthlibInjectorServer server = serverLookup.apply(apiRoot);
tryCast(storage.get("profileProperties"), Map.class).ifPresent(
it -> {
@@ -0,0 +1,61 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2020 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.auth.authlibinjector;
import org.jackhuang.hmcl.auth.AccountFactory;
import org.jackhuang.hmcl.auth.AuthenticationException;
import org.jackhuang.hmcl.auth.CharacterSelector;
import java.util.Map;
import java.util.Objects;
public class BoundAuthlibInjectorAccountFactory extends AccountFactory<AuthlibInjectorAccount> {
private final AuthlibInjectorArtifactProvider downloader;
private final AuthlibInjectorServer server;
/**
* @param server Authlib-Injector Server
*/
public BoundAuthlibInjectorAccountFactory(AuthlibInjectorArtifactProvider downloader, AuthlibInjectorServer server) {
this.downloader = downloader;
this.server = server;
}
@Override
public AccountLoginType getLoginType() {
return AccountLoginType.USERNAME_PASSWORD;
}
public AuthlibInjectorServer getServer() {
return server;
}
@Override
public AuthlibInjectorAccount create(CharacterSelector selector, String username, String password, ProgressCallback progressCallback, Object additionalData) throws AuthenticationException {
Objects.requireNonNull(selector);
Objects.requireNonNull(username);
Objects.requireNonNull(password);
return new AuthlibInjectorAccount(server, downloader, username, password, selector);
}
@Override
public AuthlibInjectorAccount fromStorage(Map<Object, Object> storage) {
return AuthlibInjectorAccountFactory.fromStorage(storage, downloader, server);
}
}
@@ -272,7 +272,7 @@ public class YggdrasilService {
.registerTypeAdapterFactory(ValidationTypeAdapterFactory.INSTANCE)
.create();
public static final String PROFILE_URL = "https://www.minecraft.net/profile";
public static final String PROFILE_URL = "https://aka.ms/MinecraftMigration";
public static final String MIGRATION_FAQ_URL = "https://help.minecraft.net/hc/en-us/articles/360050865492-JAVA-Account-Migration-FAQ";
public static final String PURCHASE_URL = "https://www.minecraft.net/zh-hans/store/minecraft-java-edition";
}
@@ -78,6 +78,8 @@ public class YggdrasilSession {
}
public static YggdrasilSession fromStorage(Map<?, ?> storage) {
Objects.requireNonNull(storage);
UUID uuid = tryCast(storage.get("uuid"), String.class).map(UUIDTypeAdapter::fromString).orElseThrow(() -> new IllegalArgumentException("uuid is missing"));
String name = tryCast(storage.get("displayName"), String.class).orElseThrow(() -> new IllegalArgumentException("displayName is missing"));
String clientToken = tryCast(storage.get("clientToken"), String.class).orElseThrow(() -> new IllegalArgumentException("clientToken is missing"));
@@ -23,6 +23,8 @@ import org.jackhuang.hmcl.download.forge.ForgeBMCLVersionList;
import org.jackhuang.hmcl.download.game.GameVersionList;
import org.jackhuang.hmcl.download.liteloader.LiteLoaderBMCLVersionList;
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltVersionList;
/**
*
@@ -36,6 +38,8 @@ public class BMCLAPIDownloadProvider implements DownloadProvider {
private final ForgeBMCLVersionList forge;
private final LiteLoaderBMCLVersionList liteLoader;
private final OptiFineBMCLVersionList optifine;
private final QuiltVersionList quilt;
private final QuiltAPIVersionList quiltApi;
public BMCLAPIDownloadProvider(String apiRoot) {
this.apiRoot = apiRoot;
@@ -45,6 +49,8 @@ public class BMCLAPIDownloadProvider implements DownloadProvider {
this.forge = new ForgeBMCLVersionList(apiRoot);
this.liteLoader = new LiteLoaderBMCLVersionList(this);
this.optifine = new OptiFineBMCLVersionList(apiRoot);
this.quilt = new QuiltVersionList(this);
this.quiltApi = new QuiltAPIVersionList(this);
}
public String getApiRoot() {
@@ -76,6 +82,10 @@ public class BMCLAPIDownloadProvider implements DownloadProvider {
return liteLoader;
case "optifine":
return optifine;
case "quilt":
return quilt;
case "quilt-api":
return quiltApi;
default:
throw new IllegalArgumentException("Unrecognized version list id: " + id);
}
@@ -86,6 +96,8 @@ public class BMCLAPIDownloadProvider implements DownloadProvider {
return baseURL
.replace("https://bmclapi2.bangbang93.com", apiRoot)
.replace("https://launchermeta.mojang.com", apiRoot)
.replace("https://piston-meta.mojang.com", apiRoot)
.replace("https://piston-data.mojang.com", apiRoot)
.replace("https://launcher.mojang.com", apiRoot)
.replace("https://libraries.minecraft.net", apiRoot + "/libraries")
.replaceFirst("https?://files\\.minecraftforge\\.net/maven", apiRoot + "/maven")
@@ -94,7 +106,8 @@ public class BMCLAPIDownloadProvider implements DownloadProvider {
.replace("http://dl.liteloader.com/versions", apiRoot + "/maven")
.replace("https://meta.fabricmc.net", apiRoot + "/fabric-meta")
.replace("https://maven.fabricmc.net", apiRoot + "/maven")
.replace("https://authlib-injector.yushi.moe", apiRoot + "/mirrors/authlib-injector");
.replace("https://authlib-injector.yushi.moe", apiRoot + "/mirrors/authlib-injector")
.replace("https://repo1.maven.org/maven2", "https://maven.aliyun.com/repository/central");
}
@Override
@@ -22,6 +22,7 @@ import org.jackhuang.hmcl.download.game.GameAssetDownloadTask;
import org.jackhuang.hmcl.download.game.GameDownloadTask;
import org.jackhuang.hmcl.download.game.GameLibrariesTask;
import org.jackhuang.hmcl.download.optifine.OptiFineInstallTask;
import org.jackhuang.hmcl.game.Artifact;
import org.jackhuang.hmcl.game.DefaultGameRepository;
import org.jackhuang.hmcl.game.Library;
import org.jackhuang.hmcl.game.Version;
@@ -32,10 +33,9 @@ import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import static org.jackhuang.hmcl.download.LibraryAnalyzer.LibraryType.OPTIFINE;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Note: This class has no state.
@@ -75,8 +75,7 @@ public class DefaultDependencyManager extends AbstractDependencyManager {
}
@Override
public Task<?> checkGameCompletionAsync(Version original, boolean integrityCheck) {
Version version = original.resolve(repository);
public Task<?> checkGameCompletionAsync(Version version, boolean integrityCheck) {
return Task.allOf(
Task.composeAsync(() -> {
File versionJar = repository.getVersionJar(version);
@@ -84,7 +83,7 @@ public class DefaultDependencyManager extends AbstractDependencyManager {
return new GameDownloadTask(this, null, version);
else
return null;
}),
}).thenComposeAsync(checkPatchCompletionAsync(version, integrityCheck)),
new GameAssetDownloadTask(this, version, GameAssetDownloadTask.DOWNLOAD_INDEX_IF_NECESSARY, integrityCheck),
new GameLibrariesTask(this, version, integrityCheck)
);
@@ -98,33 +97,51 @@ public class DefaultDependencyManager extends AbstractDependencyManager {
@Override
public Task<?> checkPatchCompletionAsync(Version version, boolean integrityCheck) {
return Task.composeAsync(() -> {
List<Task<?>> tasks = new ArrayList<>();
List<Task<?>> tasks = new ArrayList<>(0);
Optional<String> gameVersion = repository.getGameVersion(version);
if (!gameVersion.isPresent()) return null;
String gameVersion = repository.getGameVersion(version).orElse(null);
if (gameVersion == null) return null;
LibraryAnalyzer analyzer = LibraryAnalyzer.analyze(version.resolvePreservingPatches(getGameRepository()));
Version original = repository.getVersion(version.getId());
Version resolved = original.resolvePreservingPatches(repository);
LibraryAnalyzer analyzer = LibraryAnalyzer.analyze(resolved);
for (LibraryAnalyzer.LibraryType type : LibraryAnalyzer.LibraryType.values()) {
Optional<Library> library = analyzer.getLibrary(type);
if (library.isPresent() && GameLibrariesTask.shouldDownloadLibrary(repository, version, library.get(), integrityCheck)) {
tasks.add(downloadMissingLibraryAsync(gameVersion.get(), version, type, library.get()));
if (!analyzer.has(type))
continue;
if (type == LibraryAnalyzer.LibraryType.OPTIFINE) {
String optifinePatchVersion = analyzer.getVersion(type)
.map(optifineVersion -> {
Matcher matcher = Pattern.compile("^([0-9.]+)_(?<optifine>HD_.+)$").matcher(optifineVersion);
return matcher.find() ? matcher.group("optifine") : optifineVersion;
})
.orElseGet(() -> resolved.getPatches().stream()
.filter(patch -> "optifine".equals(patch.getId()))
.findAny()
.map(Version::getVersion)
.orElse(null));
boolean needsReInstallation = version.getLibraries().stream()
.anyMatch(library -> !library.hasDownloadURL()
&& "optifine".equals(library.getGroupId())
&& GameLibrariesTask.shouldDownloadLibrary(repository, version, library, integrityCheck));
if (needsReInstallation) {
Library installer = new Library(new Artifact("optifine", "OptiFine", gameVersion + "_" + optifinePatchVersion, "installer"));
if (GameLibrariesTask.shouldDownloadLibrary(repository, version, installer, integrityCheck)) {
tasks.add(installLibraryAsync(gameVersion, original, "optifine", optifinePatchVersion));
} else {
tasks.add(OptiFineInstallTask.install(this, original, repository.getLibraryFile(version, installer).toPath()));
}
}
}
}
return Task.allOf(tasks);
});
}
private Task<?> downloadMissingLibraryAsync(String gameVersion, Version version, LibraryAnalyzer.LibraryType libraryType, Library library) {
switch (libraryType) {
case OPTIFINE:
if (library.hasDownloadURL())
break;
return installLibraryAsync(gameVersion, version, libraryType.getPatchId(), library.getVersion());
}
return Task.completed(null);
}
@Override
public Task<Version> installLibraryAsync(String gameVersion, Version baseVersion, String libraryId, String libraryVersion) {
if (baseVersion.isResolved()) throw new IllegalArgumentException("Version should not be resolved");
@@ -49,8 +49,8 @@ public interface DependencyManager {
Task<?> checkGameCompletionAsync(Version version, boolean integrityCheck);
/**
* Check if the game is complete.
* Check libraries, assets files and so on.
* Check if libraries of this version in complete.
* If not, download missing libraries if possible.
*
* @return the task to check game completion.
*/
@@ -176,6 +176,8 @@ public final class LibraryAnalyzer implements Iterable<LibraryAnalyzer.LibraryMa
},
LITELOADER(true, "liteloader", Pattern.compile("com\\.mumfrey"), Pattern.compile("liteloader")),
OPTIFINE(false, "optifine", Pattern.compile("(net\\.)?optifine"), Pattern.compile("^(?!.*launchwrapper).*$")),
QUILT(true, "quilt", Pattern.compile("org\\.quiltmc"), Pattern.compile("quilt-loader")),
QUILT_API(true, "quilt-api", Pattern.compile("org\\.quiltmc"), Pattern.compile("quilt-api")),
BOOTSTRAP_LAUNCHER(false, "", Pattern.compile("cpw\\.mods"), Pattern.compile("bootstraplauncher"));
private final boolean modLoader;
@@ -110,8 +110,10 @@ public class MaintainTask extends Task<Version> {
}
if (libraryAnalyzer.has(OPTIFINE)) {
if (!libraryAnalyzer.has(LITELOADER) && !libraryAnalyzer.has(FORGE) && builder.hasTweakClass(LibraryAnalyzer.OPTIFINE_TWEAKERS[1])) {
builder.replaceTweakClass(LibraryAnalyzer.OPTIFINE_TWEAKERS[1], LibraryAnalyzer.OPTIFINE_TWEAKERS[0], !reorderTweakClass, reorderTweakClass);
if (!libraryAnalyzer.has(LITELOADER) && !libraryAnalyzer.has(FORGE)) {
if (builder.hasTweakClass(LibraryAnalyzer.OPTIFINE_TWEAKERS[1])) {
builder.replaceTweakClass(LibraryAnalyzer.OPTIFINE_TWEAKERS[1], LibraryAnalyzer.OPTIFINE_TWEAKERS[0], !reorderTweakClass, reorderTweakClass);
}
} else {
if (libraryAnalyzer.hasModLauncher()) {
// If ModLauncher installed, we use ModLauncher in place of LaunchWrapper.
@@ -119,7 +121,7 @@ public class MaintainTask extends Task<Version> {
for (String optiFineTweaker : LibraryAnalyzer.OPTIFINE_TWEAKERS) {
builder.removeTweakClass(optiFineTweaker);
}
} else {
} else if (builder.hasTweakClass(LibraryAnalyzer.OPTIFINE_TWEAKERS[0])) {
// If forge or LiteLoader installed, OptiFine Forge Tweaker is needed.
builder.replaceTweakClass(LibraryAnalyzer.OPTIFINE_TWEAKERS[0], LibraryAnalyzer.OPTIFINE_TWEAKERS[1], !reorderTweakClass, reorderTweakClass);
}
@@ -23,6 +23,8 @@ import org.jackhuang.hmcl.download.forge.ForgeBMCLVersionList;
import org.jackhuang.hmcl.download.game.GameVersionList;
import org.jackhuang.hmcl.download.liteloader.LiteLoaderVersionList;
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltVersionList;
/**
* @see <a href="http://wiki.vg">http://wiki.vg</a>
@@ -35,6 +37,8 @@ public class MojangDownloadProvider implements DownloadProvider {
private final ForgeBMCLVersionList forge;
private final LiteLoaderVersionList liteLoader;
private final OptiFineBMCLVersionList optifine;
private final QuiltVersionList quilt;
private final QuiltAPIVersionList quiltApi;
public MojangDownloadProvider() {
String apiRoot = "https://bmclapi2.bangbang93.com";
@@ -45,11 +49,13 @@ public class MojangDownloadProvider implements DownloadProvider {
this.forge = new ForgeBMCLVersionList(apiRoot);
this.liteLoader = new LiteLoaderVersionList(this);
this.optifine = new OptiFineBMCLVersionList(apiRoot);
this.quilt = new QuiltVersionList(this);
this.quiltApi = new QuiltAPIVersionList(this);
}
@Override
public String getVersionListURL() {
return "https://launchermeta.mojang.com/mc/game/version_manifest.json";
return "https://piston-meta.mojang.com/mc/game/version_manifest.json";
}
@Override
@@ -72,6 +78,10 @@ public class MojangDownloadProvider implements DownloadProvider {
return liteLoader;
case "optifine":
return optifine;
case "quilt":
return quilt;
case "quilt-api":
return quiltApi;
default:
throw new IllegalArgumentException("Unrecognized version list id: " + id);
}
@@ -109,7 +109,8 @@ public final class GameLibrariesTask extends Task<Void> {
libraries.stream().filter(Library::appliesToCurrentEnvironment).forEach(library -> {
File file = dependencyManager.getGameRepository().getLibraryFile(version, library);
if (shouldDownloadLibrary(dependencyManager.getGameRepository(), version, library, integrityCheck)) {
dependencies.add(new LibraryDownloadTask(dependencyManager, file, library));
if (library.hasDownloadURL() || !"optifine".equals(library.getGroupId()))
dependencies.add(new LibraryDownloadTask(dependencyManager, file, library));
} else {
dependencyManager.getCacheRepository().tryCacheLibrary(library, file.toPath());
}
@@ -52,7 +52,7 @@ public class JavaDownloadTask extends Task<Void> {
this.javaVersion = javaVersion;
this.rootDir = rootDir;
this.javaDownloadsTask = new GetTask(NetworkUtils.toURL(downloadProvider.injectURL(
"https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json")))
"https://piston-meta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json")))
.thenComposeAsync(javaDownloadsJson -> {
JavaDownloads allDownloads = JsonUtils.fromNonNullJson(javaDownloadsJson, JavaDownloads.class);
if (!allDownloads.getDownloads().containsKey(platform)) throw new UnsupportedPlatformException();
@@ -94,7 +94,7 @@ public class JavaDownloadTask extends Task<Void> {
RemoteFiles.RemoteFile file = ((RemoteFiles.RemoteFile) entry.getValue());
if (file.getDownloads().containsKey("lzma")) {
DownloadInfo download = file.getDownloads().get("lzma");
File tempFile = Files.createTempFile("hmcl", "tmp").toFile();
File tempFile = jvmDir.resolve(entry.getKey() + ".lzma").toFile();
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(download.getUrl()), tempFile, new FileDownloadTask.IntegrityCheck("SHA-1", download.getSha1()));
task.setName(entry.getKey());
dependencies.add(task.thenRunAsync(() -> {
@@ -4,6 +4,7 @@ import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.game.GameJavaVersion;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.util.CacheRepository;
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.platform.Architecture;
import org.jackhuang.hmcl.util.platform.JavaVersion;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
@@ -12,8 +13,11 @@ import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
import java.util.stream.Stream;
import static org.jackhuang.hmcl.util.Logging.LOG;
@@ -42,26 +46,48 @@ public final class JavaRepository {
throw new IOException("Incorrect java home " + javaHome);
}
public static void initialize() throws IOException, InterruptedException {
Optional<String> platformOptional = getSystemJavaPlatform();
if (platformOptional.isPresent()) {
String platform = platformOptional.get();
Path javaStoragePath = getJavaStoragePath();
if (Files.isDirectory(javaStoragePath)) {
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(javaStoragePath)) {
for (Path component : dirStream) {
Path javaHome = component.resolve(platform).resolve(component.getFileName());
try {
addJava(javaHome);
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to determine Java at " + javaHome, e);
}
}
}
}
public static Stream<Optional<Path>> findMinecraftRuntimeDirs() {
switch (OperatingSystem.CURRENT_OS) {
case WINDOWS:
return Stream.of(
FileUtils.tryGetPath(System.getenv("localappdata"),
"Packages\\Microsoft.4297127D64EC6_8wekyb3d8bbwe\\LocalCache\\Local\\runtime"),
FileUtils.tryGetPath(
Optional.ofNullable(System.getenv("ProgramFiles(x86)")).orElse("C:\\Program Files (x86)"),
"Minecraft Launcher\\runtime"));
case LINUX:
return Stream.of(FileUtils.tryGetPath(System.getProperty("user.home", ".minecraft/runtime")));
case OSX:
return Stream.of(FileUtils.tryGetPath("/Library/Application Support/minecraft/runtime"),
FileUtils.tryGetPath(System.getProperty("user.home"), "Library/Application Support/minecraft/runtime"));
default:
return Stream.empty();
}
}
public static Stream<Path> findJavaHomeInMinecraftRuntimeDir(Path runtimeDir) {
// Examples:
// $HOME/Library/Application Support/minecraft/runtime/java-runtime-beta/mac-os/java-runtime-beta/jre.bundle/Contents/Home
// $HOME/.minecraft/runtime/java-runtime-beta/linux/java-runtime-beta
Optional<String> platformOptional = getSystemJavaPlatform();
if (!platformOptional.isPresent()) return Stream.empty();
String platform = platformOptional.get();
List<Path> javaHomes = new ArrayList<>();
try (DirectoryStream<Path> dir = Files.newDirectoryStream(runtimeDir)) {
// component can be jre-legacy, java-runtime-alpha, java-runtime-beta, java-runtime-gamma or any other being added in the future.
for (Path component : dir) {
Path javaHome = component.resolve(platform).resolve(component.getFileName());
if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX) {
javaHomes.add(javaHome.resolve("jre.bundle/Contents/Home"));
}
javaHomes.add(javaHome);
}
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to list java-runtime directory " + runtimeDir, e);
}
return javaHomes.stream();
}
public static Optional<String> getSystemJavaPlatform() {
if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
if (Architecture.SYSTEM_ARCH == Architecture.X86) {
@@ -0,0 +1,67 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2021 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.download.quilt;
import org.jackhuang.hmcl.download.DefaultDependencyManager;
import org.jackhuang.hmcl.game.Version;
import org.jackhuang.hmcl.task.FileDownloadTask;
import org.jackhuang.hmcl.task.Task;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* <b>Note</b>: Quilt should be installed first.
*
* @author huangyuhui
*/
public final class QuiltAPIInstallTask extends Task<Version> {
private final DefaultDependencyManager dependencyManager;
private final Version version;
private final QuiltAPIRemoteVersion remote;
private final List<Task<?>> dependencies = new ArrayList<>(1);
public QuiltAPIInstallTask(DefaultDependencyManager dependencyManager, Version version, QuiltAPIRemoteVersion remoteVersion) {
this.dependencyManager = dependencyManager;
this.version = version;
this.remote = remoteVersion;
}
@Override
public Collection<Task<?>> getDependencies() {
return dependencies;
}
@Override
public boolean isRelyingOnDependencies() {
return false;
}
@Override
public void execute() throws IOException {
dependencies.add(new FileDownloadTask(
new URL(remote.getVersion().getFile().getUrl()),
dependencyManager.getGameRepository().getRunDirectory(version.getId()).toPath().resolve("mods").resolve("quilt-api-" + remote.getVersion().getVersion() + ".jar").toFile(),
remote.getVersion().getFile().getIntegrityCheck())
);
}
}
@@ -0,0 +1,67 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2022 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.download.quilt;
import org.jackhuang.hmcl.download.DefaultDependencyManager;
import org.jackhuang.hmcl.download.LibraryAnalyzer;
import org.jackhuang.hmcl.download.RemoteVersion;
import org.jackhuang.hmcl.game.Version;
import org.jackhuang.hmcl.mod.RemoteMod;
import org.jackhuang.hmcl.task.Task;
import java.util.Date;
import java.util.List;
public class QuiltAPIRemoteVersion extends RemoteVersion {
private final String fullVersion;
private final RemoteMod.Version version;
/**
* Constructor.
*
* @param gameVersion the Minecraft version that this remote version suits.
* @param selfVersion the version string of the remote version.
* @param urls the installer or universal jar original URL.
*/
QuiltAPIRemoteVersion(String gameVersion, String selfVersion, String fullVersion, Date datePublished, RemoteMod.Version version, List<String> urls) {
super(LibraryAnalyzer.LibraryType.QUILT_API.getPatchId(), gameVersion, selfVersion, datePublished, urls);
this.fullVersion = fullVersion;
this.version = version;
}
@Override
public String getFullVersion() {
return fullVersion;
}
public RemoteMod.Version getVersion() {
return version;
}
@Override
public Task<Version> getInstallTask(DefaultDependencyManager dependencyManager, Version baseVersion) {
return new QuiltAPIInstallTask(dependencyManager, baseVersion, this);
}
@Override
public int compareTo(RemoteVersion o) {
if (!(o instanceof QuiltAPIRemoteVersion)) return 0;
return -this.getReleaseDate().compareTo(o.getReleaseDate());
}
}
@@ -0,0 +1,55 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2022 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.download.quilt;
import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.download.VersionList;
import org.jackhuang.hmcl.mod.RemoteMod;
import org.jackhuang.hmcl.mod.modrinth.ModrinthRemoteModRepository;
import org.jackhuang.hmcl.util.Lang;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
import static org.jackhuang.hmcl.util.Lang.wrap;
public class QuiltAPIVersionList extends VersionList<QuiltAPIRemoteVersion> {
private final DownloadProvider downloadProvider;
public QuiltAPIVersionList(DownloadProvider downloadProvider) {
this.downloadProvider = downloadProvider;
}
@Override
public boolean hasType() {
return false;
}
@Override
public CompletableFuture<?> refreshAsync() {
return CompletableFuture.runAsync(wrap(() -> {
for (RemoteMod.Version modVersion : Lang.toIterable(ModrinthRemoteModRepository.MODS.getRemoteVersionsById("qsl"))) {
for (String gameVersion : modVersion.getGameVersions()) {
versions.put(gameVersion, new QuiltAPIRemoteVersion(gameVersion, modVersion.getVersion(), modVersion.getName(), modVersion.getDatePublished(), modVersion,
Collections.singletonList(modVersion.getFile().getUrl())));
}
}
}));
}
}
@@ -0,0 +1,221 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2022 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.download.quilt;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.jackhuang.hmcl.download.DefaultDependencyManager;
import org.jackhuang.hmcl.download.LibraryAnalyzer;
import org.jackhuang.hmcl.download.UnsupportedInstallationException;
import org.jackhuang.hmcl.game.Arguments;
import org.jackhuang.hmcl.game.Artifact;
import org.jackhuang.hmcl.game.Library;
import org.jackhuang.hmcl.game.Version;
import org.jackhuang.hmcl.task.GetTask;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.util.gson.JsonUtils;
import java.util.*;
import static org.jackhuang.hmcl.download.UnsupportedInstallationException.FABRIC_NOT_COMPATIBLE_WITH_FORGE;
/**
* <b>Note</b>: Quilt should be installed first.
*
* @author huangyuhui
*/
public final class QuiltInstallTask extends Task<Version> {
private final DefaultDependencyManager dependencyManager;
private final Version version;
private final QuiltRemoteVersion remote;
private final GetTask launchMetaTask;
private final List<Task<?>> dependencies = new ArrayList<>(1);
public QuiltInstallTask(DefaultDependencyManager dependencyManager, Version version, QuiltRemoteVersion remoteVersion) {
this.dependencyManager = dependencyManager;
this.version = version;
this.remote = remoteVersion;
launchMetaTask = new GetTask(dependencyManager.getDownloadProvider().injectURLsWithCandidates(remoteVersion.getUrls()));
launchMetaTask.setCacheRepository(dependencyManager.getCacheRepository());
}
@Override
public boolean doPreExecute() {
return true;
}
@Override
public void preExecute() throws Exception {
if (!Objects.equals("net.minecraft.client.main.Main", version.resolve(dependencyManager.getGameRepository()).getMainClass()))
throw new UnsupportedInstallationException(FABRIC_NOT_COMPATIBLE_WITH_FORGE);
}
@Override
public Collection<Task<?>> getDependents() {
return Collections.singleton(launchMetaTask);
}
@Override
public Collection<Task<?>> getDependencies() {
return dependencies;
}
@Override
public boolean isRelyingOnDependencies() {
return false;
}
@Override
public void execute() {
setResult(getPatch(JsonUtils.GSON.fromJson(launchMetaTask.getResult(), QuiltInfo.class), remote.getGameVersion(), remote.getSelfVersion()));
dependencies.add(dependencyManager.checkLibraryCompletionAsync(getResult(), true));
}
private Version getPatch(QuiltInfo quiltInfo, String gameVersion, String loaderVersion) {
JsonObject launcherMeta = quiltInfo.launcherMeta;
Arguments arguments = new Arguments();
String mainClass;
if (!launcherMeta.get("mainClass").isJsonObject()) {
mainClass = launcherMeta.get("mainClass").getAsString();
} else {
mainClass = launcherMeta.get("mainClass").getAsJsonObject().get("client").getAsString();
}
if (launcherMeta.has("launchwrapper")) {
String clientTweaker = launcherMeta.get("launchwrapper").getAsJsonObject().get("tweakers").getAsJsonObject().get("client").getAsJsonArray().get(0).getAsString();
arguments = arguments.addGameArguments("--tweakClass", clientTweaker);
}
JsonObject librariesObject = launcherMeta.getAsJsonObject("libraries");
List<Library> libraries = new ArrayList<>();
// "common, server" is hard coded in fabric installer.
// Don't know the purpose of ignoring client libraries.
for (String side : new String[]{"common", "server"}) {
for (JsonElement element : librariesObject.getAsJsonArray(side)) {
libraries.add(JsonUtils.GSON.fromJson(element, Library.class));
}
}
libraries.add(new Library(Artifact.fromDescriptor(quiltInfo.hashed.maven), getMavenRepositoryByGroup(quiltInfo.hashed.maven), null));
libraries.add(new Library(Artifact.fromDescriptor(quiltInfo.intermediary.maven), getMavenRepositoryByGroup(quiltInfo.intermediary.maven), null));
libraries.add(new Library(Artifact.fromDescriptor(quiltInfo.loader.maven), getMavenRepositoryByGroup(quiltInfo.loader.maven), null));
return new Version(LibraryAnalyzer.LibraryType.QUILT.getPatchId(), loaderVersion, 30000, arguments, mainClass, libraries);
}
private static String getMavenRepositoryByGroup(String maven) {
Artifact artifact = Artifact.fromDescriptor(maven);
switch (artifact.getGroup()) {
case "net.fabricmc":
return "https://maven.fabricmc.net/";
case "org.quiltmc":
return "https://maven.quiltmc.org/repository/release/";
default:
return "https://maven.fabricmc.net/";
}
}
public static class QuiltInfo {
private final LoaderInfo loader;
private final IntermediaryInfo hashed;
private final IntermediaryInfo intermediary;
private final JsonObject launcherMeta;
public QuiltInfo(LoaderInfo loader, IntermediaryInfo hashed, IntermediaryInfo intermediary, JsonObject launcherMeta) {
this.loader = loader;
this.hashed = hashed;
this.intermediary = intermediary;
this.launcherMeta = launcherMeta;
}
public LoaderInfo getLoader() {
return loader;
}
public IntermediaryInfo getHashed() {
return hashed;
}
public IntermediaryInfo getIntermediary() {
return intermediary;
}
public JsonObject getLauncherMeta() {
return launcherMeta;
}
}
public static class LoaderInfo {
private final String separator;
private final int build;
private final String maven;
private final String version;
private final boolean stable;
public LoaderInfo(String separator, int build, String maven, String version, boolean stable) {
this.separator = separator;
this.build = build;
this.maven = maven;
this.version = version;
this.stable = stable;
}
public String getSeparator() {
return separator;
}
public int getBuild() {
return build;
}
public String getMaven() {
return maven;
}
public String getVersion() {
return version;
}
public boolean isStable() {
return stable;
}
}
public static class IntermediaryInfo {
private final String maven;
private final String version;
public IntermediaryInfo(String maven, String version) {
this.maven = maven;
this.version = version;
}
public String getMaven() {
return maven;
}
public String getVersion() {
return version;
}
}
}
@@ -0,0 +1,44 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2022 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.download.quilt;
import org.jackhuang.hmcl.download.DefaultDependencyManager;
import org.jackhuang.hmcl.download.LibraryAnalyzer;
import org.jackhuang.hmcl.download.RemoteVersion;
import org.jackhuang.hmcl.game.Version;
import org.jackhuang.hmcl.task.Task;
import java.util.List;
public class QuiltRemoteVersion extends RemoteVersion {
/**
* Constructor.
*
* @param gameVersion the Minecraft version that this remote version suits.
* @param selfVersion the version string of the remote version.
* @param urls the installer or universal jar original URL.
*/
QuiltRemoteVersion(String gameVersion, String selfVersion, List<String> urls) {
super(LibraryAnalyzer.LibraryType.QUILT.getPatchId(), gameVersion, selfVersion, null, urls);
}
@Override
public Task<Version> getInstallTask(DefaultDependencyManager dependencyManager, Version baseVersion) {
return new QuiltInstallTask(dependencyManager, baseVersion, this);
}
}
@@ -0,0 +1,108 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2022 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.download.quilt;
import com.google.gson.reflect.TypeToken;
import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.download.VersionList;
import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.io.NetworkUtils;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import static org.jackhuang.hmcl.util.Lang.wrap;
public final class QuiltVersionList extends VersionList<QuiltRemoteVersion> {
private final DownloadProvider downloadProvider;
public QuiltVersionList(DownloadProvider downloadProvider) {
this.downloadProvider = downloadProvider;
}
@Override
public boolean hasType() {
return false;
}
@Override
public CompletableFuture<?> refreshAsync() {
return CompletableFuture.runAsync(wrap(() -> {
List<String> gameVersions = getGameVersions(GAME_META_URL);
List<String> loaderVersions = getGameVersions(LOADER_META_URL);
lock.writeLock().lock();
try {
for (String gameVersion : gameVersions)
for (String loaderVersion : loaderVersions)
versions.put(gameVersion, new QuiltRemoteVersion(gameVersion, loaderVersion,
Collections.singletonList(getLaunchMetaUrl(gameVersion, loaderVersion))));
} finally {
lock.writeLock().unlock();
}
}));
}
private static final String LOADER_META_URL = "https://meta.quiltmc.org/v3/versions/loader";
private static final String GAME_META_URL = "https://meta.quiltmc.org/v3/versions/game";
private List<String> getGameVersions(String metaUrl) throws IOException {
String json = NetworkUtils.doGet(NetworkUtils.toURL(downloadProvider.injectURL(metaUrl)));
return JsonUtils.GSON.<ArrayList<GameVersion>>fromJson(json, new TypeToken<ArrayList<GameVersion>>() {
}.getType()).stream().map(GameVersion::getVersion).collect(Collectors.toList());
}
private static String getLaunchMetaUrl(String gameVersion, String loaderVersion) {
return String.format("https://meta.quiltmc.org/v3/versions/loader/%s/%s", gameVersion, loaderVersion);
}
private static class GameVersion {
private final String version;
private final String maven;
private final boolean stable;
public GameVersion() {
this("", null, false);
}
public GameVersion(String version, String maven, boolean stable) {
this.version = version;
this.maven = maven;
this.stable = stable;
}
public String getVersion() {
return version;
}
@Nullable
public String getMaven() {
return maven;
}
public boolean isStable() {
return stable;
}
}
}
@@ -44,7 +44,7 @@ public final class CrashReportAnalyzer {
// Maybe software rendering? Suggest user for using a graphics card.
OPENGL_NOT_SUPPORTED(Pattern.compile("The driver does not appear to support OpenGL")),
GRAPHICS_DRIVER(Pattern.compile("(Pixel format not accelerated|Couldn't set pixel format|net\\.minecraftforge\\.fml.client\\.SplashProgress|org\\.lwjgl\\.LWJGLException|EXCEPTION_ACCESS_VIOLATION(.|\\n|\\r)+# C {2}\\[(ig|atio|nvoglv))")),
GRAPHICS_DRIVER(Pattern.compile("(Pixel format not accelerated|GLX: Failed to create context: GLXBadFBConfig|Couldn't set pixel format|net\\.minecraftforge\\.fml.client\\.SplashProgress|org\\.lwjgl\\.LWJGLException|EXCEPTION_ACCESS_VIOLATION(.|\\n|\\r)+# C {2}\\[(ig|atio|nvoglv))")),
// Out of memory
OUT_OF_MEMORY(Pattern.compile("(java\\.lang\\.OutOfMemoryError|The system is out of physical RAM or swap space)")),
// Memory exceeded
@@ -116,11 +116,12 @@ public enum JavaVersionConstraint {
}
},
// Minecraft currently does not provide official support for architectures other than x86 and x86-64.
VANILLA_X86(JavaVersionConstraint.RULE_MANDATORY, versionRange(JavaVersionConstraint.MIN, JavaVersionConstraint.MAX), versionRange(JavaVersionConstraint.MIN, JavaVersionConstraint.MAX)) {
VANILLA_X86(JavaVersionConstraint.RULE_SUGGESTED, versionRange(JavaVersionConstraint.MIN, JavaVersionConstraint.MAX), versionRange(JavaVersionConstraint.MIN, JavaVersionConstraint.MAX)) {
@Override
protected boolean appliesToVersionImpl(VersionNumber gameVersionNumber, @Nullable Version version,
@Nullable JavaVersion javaVersion) {
return javaVersion != null && !javaVersion.getArchitecture().isX86();
return javaVersion != null && !javaVersion.getArchitecture().isX86()
&& (OperatingSystem.CURRENT_OS != OperatingSystem.OSX || gameVersionNumber.compareTo(VersionNumber.asVersion("1.19")) < 0);
}
@Override
@@ -236,11 +237,15 @@ public enum JavaVersionConstraint {
public static JavaVersion findSuitableJavaVersion(VersionNumber gameVersion, Version version) throws InterruptedException {
VersionRanges range = findSuitableJavaVersionRange(gameVersion, version);
boolean skipCheckArchitecture = Architecture.CURRENT_ARCH.isX86()
|| (OperatingSystem.CURRENT_OS == OperatingSystem.OSX && gameVersion.compareTo(VersionNumber.asVersion("1.19")) >= 0)
|| OperatingSystem.CURRENT_OS == OperatingSystem.LINUX;
JavaVersion mandatory = null;
JavaVersion suggested = null;
for (JavaVersion javaVersion : JavaVersion.getJavas()) {
// select the latest x86 java that this version accepts.
if (!javaVersion.getArchitecture().isX86())
if (!skipCheckArchitecture && !javaVersion.getArchitecture().isX86())
continue;
VersionNumber javaVersionNumber = javaVersion.getVersionNumber();
@@ -58,6 +58,7 @@ public class LaunchOptions implements Serializable {
private NativesDirectoryType nativesDirType;
private String nativesDir;
private ProcessPriority processPriority = ProcessPriority.NORMAL;
private boolean useSoftwareRenderer;
private boolean useNativeGLFW;
private boolean useNativeOpenAL;
private boolean daemon;
@@ -242,6 +243,10 @@ public class LaunchOptions implements Serializable {
return processPriority;
}
public boolean isUseSoftwareRenderer() {
return useSoftwareRenderer;
}
public boolean isUseNativeGLFW() {
return useNativeGLFW;
}
@@ -421,6 +426,10 @@ public class LaunchOptions implements Serializable {
return options.nativesDir;
}
public boolean isUseSoftwareRenderer() {
return options.useSoftwareRenderer;
}
public boolean isUseNativeGLFW() {
return options.useNativeGLFW;
}
@@ -561,6 +570,11 @@ public class LaunchOptions implements Serializable {
return this;
}
public Builder setUseSoftwareRenderer(boolean useSoftwareRenderer) {
options.useSoftwareRenderer = useSoftwareRenderer;
return this;
}
public Builder setUseNativeGLFW(boolean useNativeGLFW) {
options.useNativeGLFW = useNativeGLFW;
return this;
@@ -21,7 +21,10 @@ import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.platform.CommandBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
*
@@ -48,6 +51,11 @@ public final class VersionLibraryBuilder {
public Version build() {
Version ret = version;
if (useMcArgs) {
// The official launcher will not parse the "arguments" property when it detects the presence of "mcArgs".
// The "arguments" property with the "rule" is simply ignored here.
this.mcArgs.addAll(this.game.stream().map(arg -> arg.toString(new HashMap<>(), new HashMap<>())).flatMap(Collection::stream).collect(Collectors.toList()));
ret = ret.setArguments(null);
// Since $ will be escaped in linux, and our maintain of minecraftArgument will not cause escaping,
// so we regenerate the minecraftArgument without escaping.
ret = ret.setMinecraftArguments(new CommandBuilder().addAllWithoutParsing(mcArgs).toString());
@@ -28,7 +28,6 @@ import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.Unzipper;
import org.jackhuang.hmcl.util.io.Zipper;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -77,6 +76,10 @@ public class World {
return worldName;
}
public Path getLevelDatFile() {
return file.resolve("level.dat");
}
public long getLastPlayed() {
return lastPlayed;
}
@@ -142,14 +145,10 @@ public class World {
throw new IOException("Not a valid world directory");
// Change the name recorded in level.dat
Path levelDat = file.resolve("level.dat");
CompoundTag nbt = parseLevelDat(levelDat);
CompoundTag nbt = readLevelDat();
CompoundTag data = nbt.get("Data");
data.put(new StringTag("LevelName", newName));
try (OutputStream os = new GZIPOutputStream(Files.newOutputStream(levelDat))) {
NBTIO.writeTag(os, nbt);
}
writeLevelDat(nbt);
// then change the folder's name
Files.move(file, file.resolveSibling(newName));
@@ -203,8 +202,26 @@ public class World {
}
}
public CompoundTag readLevelDat() throws IOException {
if (!Files.isDirectory(file))
throw new IOException("Not a valid world directory");
return parseLevelDat(getLevelDatFile());
}
public void writeLevelDat(CompoundTag nbt) throws IOException {
if (!Files.isDirectory(file))
throw new IOException("Not a valid world directory");
FileUtils.saveSafely(getLevelDatFile(), os -> {
try (OutputStream gos = new GZIPOutputStream(os)) {
NBTIO.writeTag(gos, nbt);
}
});
}
private static CompoundTag parseLevelDat(Path path) throws IOException {
try (InputStream is = new BufferedInputStream(new GZIPInputStream(Files.newInputStream(path)))) {
try (InputStream is = new GZIPInputStream(Files.newInputStream(path))) {
Tag nbt = NBTIO.readTag(is);
if (nbt instanceof CompoundTag)
return (CompoundTag) nbt;
@@ -481,6 +481,11 @@ public class DefaultLauncher extends Launcher {
env.put("INST_MC_DIR", repository.getRunDirectory(version.getId()).getAbsolutePath());
env.put("INST_JAVA", options.getJava().getBinary().toString());
if (options.isUseSoftwareRenderer() && OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
env.put("LIBGL_ALWAYS_SOFTWARE", "1");
env.put("__GLX_VENDOR_LIBRARY_NAME", "mesa");
}
LibraryAnalyzer analyzer = LibraryAnalyzer.analyze(version);
if (analyzer.has(LibraryAnalyzer.LibraryType.FORGE)) {
env.put("INST_FORGE", "1");
@@ -26,9 +26,7 @@ import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.platform.ManagedProcess;
import java.util.Collection;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
/**
*
@@ -60,21 +58,37 @@ final class ExitWaiter implements Runnable {
for (Thread thread : joins)
thread.join();
List<String> errorLines = process.getLines().stream()
.filter(Log4jLevel::guessLogLineError).collect(Collectors.toList());
ProcessListener.ExitType exitType;
ProcessListener.ExitType exitType = null;
for (String line : process.getLines()) {
Log4jLevel level = Log4jLevel.guessLevel(line);
if (Log4jLevel.isError(level)) {
// LaunchWrapper will catch the exception logged and will exit normally.
if (exitCode != 0 && StringUtils.containsOne(line,
"Could not create the Java Virtual Machine.",
"Error occurred during initialization of VM",
"A fatal exception has occurred. Program will exit.")) {
EventBus.EVENT_BUS.fireEvent(new JVMLaunchFailedEvent(this, process));
exitType = ProcessListener.ExitType.JVM_ERROR;
break;
}
// LaunchWrapper will catch the exception logged and will exit normally.
if (exitCode != 0 && StringUtils.containsOne(errorLines,
"Could not create the Java Virtual Machine.",
"Error occurred during initialization of VM",
"A fatal exception has occurred. Program will exit.")) {
EventBus.EVENT_BUS.fireEvent(new JVMLaunchFailedEvent(this, process));
exitType = ProcessListener.ExitType.JVM_ERROR;
} else if (exitCode != 0 || StringUtils.containsOne(errorLines, "Unable to launch")) {
EventBus.EVENT_BUS.fireEvent(new ProcessExitedAbnormallyEvent(this, process));
exitType = ProcessListener.ExitType.APPLICATION_ERROR;
} else
if (exitCode != 0 || StringUtils.containsOne(line, "Unable to launch")) {
EventBus.EVENT_BUS.fireEvent(new ProcessExitedAbnormallyEvent(this, process));
exitType = ProcessListener.ExitType.APPLICATION_ERROR;
break;
}
}
if (level == Log4jLevel.WARN) {
if (StringUtils.containsOne(line, "Failed to create window")) {
EventBus.EVENT_BUS.fireEvent(new ProcessExitedAbnormallyEvent(this, process));
exitType = ProcessListener.ExitType.APPLICATION_ERROR;
break;
}
}
}
if (exitType == null)
exitType = ProcessListener.ExitType.NORMAL;
EventBus.EVENT_BUS.fireEvent(new ProcessStoppedEvent(this, process));
@@ -38,7 +38,7 @@ public final class LiteModMetadata {
private final String mcversion;
private final String revision;
private final String author;
private final String classTransformerClasses;
private final String[] classTransformerClasses;
private final String description;
private final String modpackName;
private final String modpackVersion;
@@ -46,10 +46,10 @@ public final class LiteModMetadata {
private final String updateURI;
public LiteModMetadata() {
this("", "", "", "", "", "", "", "", "", "", "");
this("", "", "", "", "", new String[]{""}, "", "", "", "", "");
}
public LiteModMetadata(String name, String version, String mcversion, String revision, String author, String classTransformerClasses, String description, String modpackName, String modpackVersion, String checkUpdateUrl, String updateURI) {
public LiteModMetadata(String name, String version, String mcversion, String revision, String author, String[] classTransformerClasses, String description, String modpackName, String modpackVersion, String checkUpdateUrl, String updateURI) {
this.name = name;
this.version = version;
this.mcversion = mcversion;
@@ -83,7 +83,7 @@ public final class LiteModMetadata {
return author;
}
public String getClassTransformerClasses() {
public String[] getClassTransformerClasses() {
return classTransformerClasses;
}
@@ -305,10 +305,6 @@ public final class ModManager {
return getModsDirectory().resolve(fileName);
}
public static String getMcmodUrl(String mcmodId) {
return String.format("https://www.mcmod.cn/class/%s.html", mcmodId);
}
public static String getMcbbsUrl(String mcbbsId) {
return String.format("https://www.mcbbs.net/thread-%s-1-1.html", mcbbsId);
}
@@ -25,6 +25,8 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import static org.jackhuang.hmcl.util.io.NetworkUtils.encodeLocation;
public class RemoteMod {
private final String slug;
private final String author;
@@ -199,7 +201,7 @@ public class RemoteMod {
}
public String getUrl() {
return url;
return encodeLocation (url);
}
public String getFilename() {
@@ -17,6 +17,8 @@
*/
package org.jackhuang.hmcl.mod;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
@@ -49,7 +51,7 @@ public interface RemoteModRepository {
DESC
}
Stream<RemoteMod> search(String gameVersion, Category category, int pageOffset, int pageSize, String searchFilter, SortType sortType, SortOrder sortOrder)
Stream<RemoteMod> search(String gameVersion, @Nullable Category category, int pageOffset, int pageSize, String searchFilter, SortType sortType, SortOrder sortOrder)
throws IOException;
Optional<RemoteMod.Version> getRemoteVersionByLocalFile(LocalModFile localModFile, Path file) throws IOException;
@@ -87,7 +89,7 @@ public interface RemoteModRepository {
}
String[] DEFAULT_GAME_VERSIONS = new String[]{
"1.18.1", "1.18",
"1.18.2", "1.18.1", "1.18",
"1.17.1", "1.17",
"1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16",
"1.15.2", "1.15.1", "1.15",
@@ -182,8 +182,8 @@ public class CurseAddon implements RemoteMod.IMod {
public List<RemoteMod> loadDependencies(RemoteModRepository modRepository) throws IOException {
Set<Integer> dependencies = latestFiles.stream()
.flatMap(latestFile -> latestFile.getDependencies().stream())
.filter(dep -> dep.getType() == 3)
.map(Dependency::getAddonId)
.filter(dep -> dep.getRelationType() == 3)
.map(Dependency::getModId)
.collect(Collectors.toSet());
List<RemoteMod> mods = new ArrayList<>();
for (int dependencyId : dependencies) {
@@ -370,36 +370,24 @@ public class CurseAddon implements RemoteMod.IMod {
@Immutable
public static class Dependency {
private final int id;
private final int addonId;
private final int type;
private final int fileId;
private final int modId;
private final int relationType;
public Dependency() {
this(0, 0, 0, 0);
this(0, 1);
}
public Dependency(int id, int addonId, int type, int fileId) {
this.id = id;
this.addonId = addonId;
this.type = type;
this.fileId = fileId;
public Dependency(int modId, int relationType) {
this.modId = modId;
this.relationType = relationType;
}
public int getId() {
return id;
public int getModId() {
return modId;
}
public int getAddonId() {
return addonId;
}
public int getType() {
return type;
}
public int getFileId() {
return fileId;
public int getRelationType() {
return relationType;
}
}
@@ -24,6 +24,7 @@ import org.jackhuang.hmcl.mod.RemoteModRepository;
import org.jackhuang.hmcl.util.MurmurHash2;
import org.jackhuang.hmcl.util.io.HttpRequest;
import org.jackhuang.hmcl.util.io.JarUtils;
import org.jetbrains.annotations.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -92,7 +93,7 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository
}
@Override
public Stream<RemoteMod> search(String gameVersion, RemoteModRepository.Category category, int pageOffset, int pageSize, String searchFilter, SortType sortType, SortOrder sortOrder) throws IOException {
public Stream<RemoteMod> search(String gameVersion, @Nullable RemoteModRepository.Category category, int pageOffset, int pageSize, String searchFilter, SortType sortType, SortOrder sortOrder) throws IOException {
int categoryId = 0;
if (category != null) categoryId = ((CurseAddon.Category) category.getSelf()).getId();
Response<List<CurseAddon>> response = HttpRequest.GET(PREFIX + "/v1/mods/search",
@@ -144,9 +145,11 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository
@Override
public RemoteMod getModById(String id) throws IOException {
return HttpRequest.GET(PREFIX + "/v1/mods/" + id)
Response<CurseAddon> response = HttpRequest.GET(PREFIX + "/v1/mods/" + id)
.header("X-API-KEY", apiKey)
.getJson(CurseAddon.class).toMod();
.getJson(new TypeToken<Response<CurseAddon>>() {
}.getType());
return response.data.toMod();
}
@Override
@@ -28,6 +28,7 @@ import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.io.HttpRequest;
import org.jackhuang.hmcl.util.io.NetworkUtils;
import org.jackhuang.hmcl.util.io.ResponseCodeException;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.nio.file.Path;
@@ -73,12 +74,15 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
}
@Override
public Stream<RemoteMod> search(String gameVersion, Category category, int pageOffset, int pageSize, String searchFilter, SortType sort, SortOrder sortOrder) throws IOException {
public Stream<RemoteMod> search(String gameVersion, @Nullable RemoteModRepository.Category category, int pageOffset, int pageSize, String searchFilter, SortType sort, SortOrder sortOrder) throws IOException {
List<List<String>> facets = new ArrayList<>();
facets.add(Collections.singletonList("project_type:" + projectType));
if (StringUtils.isNotBlank(gameVersion)) {
facets.add(Collections.singletonList("versions:" + gameVersion));
}
if (category != null && StringUtils.isNotBlank(category.getId())) {
facets.add(Collections.singletonList("categories:" + category.getId()));
}
Map<String, String> query = mapOf(
pair("query", searchFilter),
pair("facets", JsonUtils.UGLY_GSON.toJson(facets)),
@@ -131,14 +135,52 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
return versions.stream().map(ProjectVersion::toVersion).flatMap(Lang::toStream);
}
public List<String> getCategoriesImpl() throws IOException {
return HttpRequest.GET(PREFIX + "/v2/tag/category").getJson(new TypeToken<List<String>>() {
}.getType());
public List<Category> getCategoriesImpl() throws IOException {
List<Category> categories = HttpRequest.GET(PREFIX + "/v2/tag/category").getJson(new TypeToken<List<Category>>() {}.getType());
return categories.stream().filter(category -> category.getProjectType().equals(projectType)).collect(Collectors.toList());
}
public Stream<Category> getCategories() throws IOException {
return getCategoriesImpl().stream()
.map(name -> new Category(null, name, Collections.emptyList()));
@Override
public Stream<RemoteModRepository.Category> getCategories() throws IOException {
return getCategoriesImpl().stream().map(Category::toCategory);
}
public static class Category {
private final String icon;
private final String name;
@SerializedName("project_type")
private final String projectType;
public Category() {
this("","","");
}
public Category(String icon, String name, String projectType) {
this.icon = icon;
this.name = name;
this.projectType = projectType;
}
public String getIcon() {
return icon;
}
public String getName() {
return name;
}
public String getProjectType() {
return projectType;
}
public RemoteModRepository.Category toCategory() {
return new RemoteModRepository.Category(
this,
name,
Collections.emptyList());
}
}
public static class Project implements RemoteMod.IMod {
@@ -89,6 +89,12 @@ public final class MultiMCModpackInstallTask extends Task<Void> {
if (c.getVersion() != null)
builder.version("fabric", c.getVersion());
});
Optional<MultiMCManifest.MultiMCManifestComponent> quilt = manifest.getMmcPack().getComponents().stream().filter(e -> e.getUid().equals("net.quiltmc.quilt-loader")).findAny();
quilt.ifPresent(c -> {
if (c.getVersion() != null)
builder.version("quilt", c.getVersion());
});
}
dependents.add(builder.buildAsync());
@@ -121,7 +121,7 @@ public abstract class FetchTask<T> extends Task<T> {
continue;
}
} else if (responseCode / 100 == 4) {
throw new FileNotFoundException();
throw new FileNotFoundException(url.toString());
} else if (responseCode / 100 != 2) {
throw new ResponseCodeException(url, responseCode);
}
@@ -235,6 +235,15 @@ public final class Lang {
}
}
public static Double toDoubleOrNull(Object string) {
try {
if (string == null) return null;
return Double.parseDouble(string.toString());
} catch (NumberFormatException e) {
return null;
}
}
/**
* Find the first non-null reference in given list.
* @param t nullable references list.
@@ -27,10 +27,13 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException;
import java.util.Date;
import java.util.Locale;
import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME;
/**
*
* @author huangyuhui
@@ -65,20 +68,28 @@ public final class DateTypeAdapter implements JsonSerializer<Date>, JsonDeserial
public static final DateFormat EN_US_FORMAT = DateFormat.getDateTimeInstance(2, 2, Locale.US);
public static final DateFormat ISO_8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
public static final DateTimeFormatter ISO_DATE_TIME = new DateTimeFormatterBuilder()
.append(ISO_LOCAL_DATE_TIME)
.optionalStart().appendOffset("+HH:MM", "+00:00").optionalEnd()
.optionalStart().appendOffset("+HHMM", "+0000").optionalEnd()
.optionalStart().appendOffset("+HH", "Z").optionalEnd()
.optionalStart().appendOffsetId().optionalEnd()
.toFormatter();
public static Date deserializeToDate(String string) {
synchronized (EN_US_FORMAT) {
try {
return EN_US_FORMAT.parse(string);
} catch (ParseException ex1) {
try {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(string, DateTimeFormatter.ISO_DATE_TIME);
ZonedDateTime zonedDateTime = ZonedDateTime.parse(string, ISO_DATE_TIME);
return Date.from(zonedDateTime.toInstant());
} catch (DateTimeParseException e) {
try {
LocalDateTime localDateTime = LocalDateTime.parse(string, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
LocalDateTime localDateTime = LocalDateTime.parse(string, ISO_LOCAL_DATE_TIME);
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
} catch (DateTimeParseException e2) {
throw new JsonParseException("Invalid date: " + string, e2);
throw new JsonParseException("Invalid date: " + string, e);
}
}
}
@@ -23,6 +23,7 @@ import org.jackhuang.hmcl.util.platform.OperatingSystem;
import java.io.File;
import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.*;
@@ -72,7 +73,7 @@ public final class CompressingUtils {
int clen = (int)(ba.length * cd.maxCharsPerByte());
if (clen == 0) continue;
if (clen <= cb.capacity())
cb.clear();
((Buffer) cb).clear(); // cast to prevent "java.lang.NoSuchMethodError: java.nio.CharBuffer.clear()Ljava/nio/CharBuffer;" when compiling with Java 9+
else
cb = CharBuffer.allocate(clen);
@@ -19,11 +19,9 @@ package org.jackhuang.hmcl.util.io;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.function.ExceptionalConsumer;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.*;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.nio.file.*;
@@ -445,4 +443,21 @@ public final class FileUtils {
Files.move(tmpFile, file, StandardCopyOption.REPLACE_EXISTING);
}
public static void saveSafely(Path file, ExceptionalConsumer<? super OutputStream, IOException> action) throws IOException {
Path tmpFile = tmpSaveFile(file);
try (OutputStream os = Files.newOutputStream(tmpFile, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE)) {
action.accept(os);
}
try {
if (Files.exists(file) && Files.getAttribute(file, "dos:hidden") == Boolean.TRUE) {
Files.setAttribute(tmpFile, "dos:hidden", true);
}
} catch (Throwable ignored) {
}
Files.move(tmpFile, file, StandardCopyOption.REPLACE_EXISTING);
}
}
@@ -17,6 +17,8 @@
*/
package org.jackhuang.hmcl.util.platform;
import org.jackhuang.hmcl.util.versioning.VersionNumber;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Locale;
@@ -45,6 +47,9 @@ public enum Architecture {
S390(BIT_32),
S390X(BIT_64, "S390x"),
RISCV(BIT_64, "RISC-V"),
LOONGARCH32(BIT_32, "LoongArch32"),
LOONGARCH64_OW(BIT_64, "LoongArch64 (old world)"),
LOONGARCH64(BIT_64, "LoongArch64"),
UNKNOWN(Bits.UNKNOWN, "Unknown");
private final String checkedName;
@@ -168,6 +173,13 @@ public enum Architecture {
return S390;
case "s390x":
return S390X;
case "loongarch32":
return LOONGARCH32;
case "loongarch64": {
if (VersionNumber.VERSION_COMPARATOR.compare(System.getProperty("os.version"), "5.19") < 0)
return LOONGARCH64_OW;
return LOONGARCH64;
}
default:
if (value.startsWith("armv7")) {
return ARM32;
@@ -17,6 +17,7 @@
*/
package org.jackhuang.hmcl.util.platform;
import org.jackhuang.hmcl.download.java.JavaRepository;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.StringUtils;
@@ -64,6 +65,10 @@ public final class JavaVersion {
}
}
public String toString() {
return "JavaVersion {" + binary + ", " + longVersion + "(" + version + ")" + ", " + platform + "}";
}
public Path getBinary() {
return binary;
}
@@ -106,6 +111,8 @@ public final class JavaVersion {
private static final Pattern OS_ARCH = Pattern.compile("os\\.arch = (?<arch>.*)");
private static final Pattern JAVA_VERSION = Pattern.compile("java\\.version = (?<version>.*)");
private static final String JAVA_EXECUTABLE = OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS ? "java.exe" : "java";
public static final int UNKNOWN = -1;
public static final int JAVA_6 = 6;
public static final int JAVA_7 = 7;
@@ -201,11 +208,7 @@ public final class JavaVersion {
}
public static Path getExecutable(Path javaHome) {
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
return javaHome.resolve("bin").resolve("java.exe");
} else {
return javaHome.resolve("bin").resolve("java");
}
return javaHome.resolve("bin").resolve(JAVA_EXECUTABLE);
}
public static JavaVersion fromCurrentEnvironment() {
@@ -295,9 +298,13 @@ public final class JavaVersion {
}
private static Stream<Path> searchPotentialJavaExecutables() throws IOException {
// Add order:
// 1. System-defined locations
// 2. Minecraft-installed locations
// 3. PATH
List<Stream<Path>> javaExecutables = new ArrayList<>();
switch (OperatingSystem.CURRENT_OS) {
switch (OperatingSystem.CURRENT_OS) {
case WINDOWS:
javaExecutables.add(queryJavaHomesInRegistryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\").stream().map(JavaVersion::getExecutable));
javaExecutables.add(queryJavaHomesInRegistryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\").stream().map(JavaVersion::getExecutable));
@@ -309,55 +316,19 @@ public final class JavaVersion {
FileUtils.tryGetPath(Optional.ofNullable(System.getenv("ProgramFiles(x86)")).orElse("C:\\Program Files (x86)")),
FileUtils.tryGetPath(Optional.ofNullable(System.getenv("ProgramFiles(ARM)")).orElse("C:\\Program Files (ARM)"))
)) {
if (programFiles.isPresent()) {
javaExecutables.add(listDirectory(programFiles.get().resolve("Java")).map(JavaVersion::getExecutable));
javaExecutables.add(listDirectory(programFiles.get().resolve("BellSoft")).map(JavaVersion::getExecutable));
javaExecutables.add(listDirectory(programFiles.get().resolve("AdoptOpenJDK")).map(JavaVersion::getExecutable));
javaExecutables.add(listDirectory(programFiles.get().resolve("Zulu")).map(JavaVersion::getExecutable));
javaExecutables.add(listDirectory(programFiles.get().resolve("Microsoft")).map(JavaVersion::getExecutable));
javaExecutables.add(listDirectory(programFiles.get().resolve("Eclipse Foundation")).map(JavaVersion::getExecutable));
javaExecutables.add(listDirectory(programFiles.get().resolve("Semeru")).map(JavaVersion::getExecutable));
if (!programFiles.isPresent())
continue;
for (String vendor : new String[]{"Java", "BellSoft", "AdoptOpenJDK", "Zulu", "Microsoft", "Eclipse Foundation", "Semeru"}) {
javaExecutables.add(listDirectory(programFiles.get().resolve(vendor)).map(JavaVersion::getExecutable));
}
}
final Optional<Path> programFilesX86 = FileUtils.tryGetPath(Optional.ofNullable(System.getenv("ProgramFiles(x86)")).orElse("C:\\Program Files (x86)"));
if (programFilesX86.isPresent()) {
final Path runtimeDir = programFilesX86.get().resolve("Minecraft Launcher").resolve("runtime");
javaExecutables.add(Stream.of(
runtimeDir.resolve("jre-legacy").resolve("windows-x64").resolve("jre-legacy"),
runtimeDir.resolve("jre-legacy").resolve("windows-x86").resolve("jre-legacy"),
runtimeDir.resolve("java-runtime-alpha").resolve("windows-x64").resolve("java-runtime-alpha"),
runtimeDir.resolve("java-runtime-alpha").resolve("windows-x86").resolve("java-runtime-alpha")
).map(JavaVersion::getExecutable));
}
if (System.getenv("PATH") != null) {
javaExecutables.add(Arrays.stream(System.getenv("PATH").split(";")).flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, "java.exe"))));
}
if (System.getenv("HMCL_JRES") != null) {
javaExecutables.add(Arrays.stream(System.getenv("HMCL_JRES").split(";")).flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, "bin", "java.exe"))));
}
break;
case LINUX:
javaExecutables.add(listDirectory(Paths.get("/usr/java")).map(JavaVersion::getExecutable)); // Oracle RPMs
javaExecutables.add(listDirectory(Paths.get("/usr/lib/jvm")).map(JavaVersion::getExecutable)); // General locations
javaExecutables.add(listDirectory(Paths.get("/usr/lib32/jvm")).map(JavaVersion::getExecutable)); // General locations
if (System.getenv("PATH") != null) {
javaExecutables.add(Arrays.stream(System.getenv("PATH").split(":")).flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, "java"))));
}
if (System.getenv("HMCL_JRES") != null) {
javaExecutables.add(Arrays.stream(System.getenv("HMCL_JRES").split(":")).flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, "bin", "java"))));
}
final Optional<Path> home = FileUtils.tryGetPath(System.getProperty("user.home", ""));
if (home.isPresent()) {
final Path runtimeDir = home.get().resolve(".minecraft").resolve("runtime");
javaExecutables.add(Stream.of(
runtimeDir.resolve("jre-legacy").resolve("linux").resolve("jre-legacy"),
runtimeDir.resolve("java-runtime-alpha").resolve("linux").resolve("java-runtime-alpha")
).map(JavaVersion::getExecutable));
}
break;
case OSX:
@@ -369,18 +340,30 @@ public final class JavaVersion {
.map(JavaVersion::getExecutable));
javaExecutables.add(Stream.of(Paths.get("/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java")));
javaExecutables.add(Stream.of(Paths.get("/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java/bin/java")));
javaExecutables.add(Stream.of(Paths.get("/Library/Application Support/minecraft/runtime/jre-x64/jre.bundle/Contents/Home/bin/java")));
if (System.getenv("PATH") != null) {
javaExecutables.add(Arrays.stream(System.getenv("PATH").split(":")).flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, "java"))));
}
if (System.getenv("HMCL_JRES") != null) {
javaExecutables.add(Arrays.stream(System.getenv("HMCL_JRES").split(":")).flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, "bin", "java"))));
}
break;
default:
break;
}
// Search Minecraft bundled runtimes.
javaExecutables.add(Stream.concat(Stream.of(Optional.of(JavaRepository.getJavaStoragePath())), JavaRepository.findMinecraftRuntimeDirs())
.flatMap(Lang::toStream)
.flatMap(JavaRepository::findJavaHomeInMinecraftRuntimeDir)
.map(JavaVersion::getExecutable));
// Search in PATH.
if (System.getenv("PATH") != null) {
javaExecutables.add(Arrays.stream(System.getenv("PATH").split(OperatingSystem.PATH_SEPARATOR))
.flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, JAVA_EXECUTABLE))));
}
// Search in HMCL_JRES, convenient environment variable for users to add JRE in global
// May be removed when we implement global Java configuration.
if (System.getenv("HMCL_JRES") != null) {
javaExecutables.add(Arrays.stream(System.getenv("HMCL_JRES").split(OperatingSystem.PATH_SEPARATOR))
.flatMap(path -> Lang.toStream(FileUtils.tryGetPath(path, "bin", JAVA_EXECUTABLE))));
}
return javaExecutables.parallelStream().flatMap(stream -> stream);
}
@@ -456,4 +439,14 @@ public final class JavaVersion {
return null;
}
// ====
public static void main(String[] args) {
try {
LOG.setLevel(Level.ALL);
initialize();
LOG.info(JAVAS.toString());
} catch (Throwable e) {
LOG.log(Level.WARNING, "Oops:", e);
}
}
}
@@ -14,6 +14,21 @@ public final class Platform {
public static final Platform CURRENT_PLATFORM = Platform.getPlatform(OperatingSystem.CURRENT_OS, Architecture.CURRENT_ARCH);
public static final Platform SYSTEM_PLATFORM = Platform.getPlatform(OperatingSystem.CURRENT_OS, Architecture.SYSTEM_ARCH);
public static boolean isCompatibleWithX86Java() {
if (Architecture.CURRENT_ARCH.isX86())
return true;
// Rosetta 2 is available for Mac computers with Apple silicon
if (CURRENT_PLATFORM == OSX_ARM64)
return true;
// Windows on ARM introduced translation support for x86-64 after 10.0.21277.
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS && OperatingSystem.SYSTEM_BUILD_NUMBER >= 21277)
return true;
return false;
}
private final OperatingSystem os;
private final Architecture arch;
@@ -0,0 +1,29 @@
package org.jackhuang.hmcl.util.gson;
import org.junit.Assert;
import org.junit.Test;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
public class DateTypeAdapterTest {
@Test
public void parse() {
Assert.assertEquals(
LocalDateTime.of(2017, 6, 8, 4, 26, 33)
.atOffset(ZoneOffset.UTC).toInstant(),
DateTypeAdapter.deserializeToDate("2017-06-08T04:26:33+0000").toInstant());
Assert.assertEquals(
LocalDateTime.of(2021, 1, 3, 0, 53, 34)
.atOffset(ZoneOffset.UTC).toInstant(),
DateTypeAdapter.deserializeToDate("2021-01-03T00:53:34+00:00").toInstant());
Assert.assertEquals(
LocalDateTime.of(2021, 1, 3, 0, 53, 34)
.atZone(ZoneId.systemDefault()).toInstant(),
DateTypeAdapter.deserializeToDate("2021-01-03T00:53:34").toInstant());
}
}
+30 -35
View File
@@ -1,64 +1,59 @@
# ⛏ Hello Minecraft! Launcher 💎
[![Build Status](https://ci.huangyuhui.net/job/HMCL/badge/icon?.svg)](https://ci.huangyuhui.net/job/HMCL)
![Downloads](https://img.shields.io/github/downloads/huanghongxun/HMCL/total)
![Stars](https://img.shields.io/github/stars/huanghongxun/HMCL)
[![Discord](https://img.shields.io/discord/995291757799538688.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/jVvC7HfM6U)
[![KOOK](https://img.shields.io/badge/KOOK-HMCL-brightgreen)](https://kook.top/Kx7n3t)
Join chat! ![Discord](https://img.shields.io/discord/879708313435123742?style=plastic) [Discord](https://discord.gg/jVvC7HfM6U) [KaiHeiLa](https://kaihei.co/Kx7n3t)
English | [中文](https://github.com/huanghongxun/HMCL/blob/javafx/README_cn.md)
## Introduction
HMCL is a Minecraft launcher which supports Mod management, game customizing, auto installing(Forge, LiteLoader and OptiFine), modpack creating, UI customization, and more.
HMCL is a Minecraft launcher which supports Mod Management, Game Customizing, Auto Installing (Forge, Fabric, LiteLoader and OptiFine), Modpack Creating, UI Customization, and more.
No plugin API is provided.
## Download
Download the latest version [from the official website](https://hmcl.huangyuhui.net/download).
Download the latest version from [the official website](https://hmcl.huangyuhui.net/download).
Note: The recent version released in Github is the beta version, which contains extra testing functions compared to the release versions on the official website. However, they may be unstable and you're more likely to encounter bugs or unexpected problems.
Note: The recent versions released in GitHub are beta versions, which contains extra testing functions compared to the release versions on the official website. However, they may be unstable and you're more likely to encounter bugs or unexpected problems.
Although not necessary, it is recommended to download the ones from the official website.
## License
The software is distributed under [GPL v3](https://www.gnu.org/licenses/gpl-3.0.html) with additional terms.
The software is distributed under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html) with additional terms.
### Additional terms under GPLv3 Section 7
1. When you distribute a modified version of the software, you must change the software name or the version number in a reasonable way in order to distinguish it from the original version. \[[under GPLv3, 7(c).](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L372-L374)\]
1. When you distribute a modified version of the software, you must change the software name or the version number in a reasonable way in order to distinguish it from the original version. (Under [GPLv3, 7(c)](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L372-L374))
The software name and the version number can be edited [here](https://github.com/huanghongxun/HMCL/blob/javafx/HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java#L32-L34).
The software name and the version number can be edited [here](https://github.com/huanghongxun/HMCL/blob/javafx/HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java#L33-L35).
2. You must not remove the copyright declaration displayed in the software. \[[under GPLv3, 7(b).](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L368-L370)\]
Chinese Translation:
### 附加条款(依据 GPLv3 协议第七条)
1. 当你分发本程序的修改版本时,你必须以一种合理的方式修改本程序的名称或版本号,以示其与原始版本不同。\[[依据 GPLv3, 7(c).](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L372-L374)\]
本程序的名称及版本号可在[此处](https://github.com/huanghongxun/HMCL/blob/javafx/HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java#L32-L34)修改。
2. 你不得移除本程序所显示的版权声明。\[[依据 GPLv3, 7(b).](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L368-L370)\]
2. You must not remove the copyright declaration displayed in the software. (Under [GPLv3, 7(b)](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L368-L370))
## Contribution
If you want to submit a pull request, there are some requirements:
* IDE: Intellij IDEA.
* Compiler: Java 1.8.
* Do NOT modify `gradle` files.
* IDE: Intellij IDEA
* Compiler: Java 1.8
* Do NOT modify `gradle` files
### Compilation
Simply execute the following command in project root directory:
Simply execute the following command:
```bash
./gradlew clean build
```
Make sure you have Java installed with JavaFX 8 at least. Liberica full JDK 8 or later is recommended.
Make sure you have Java installed with JavaFX 8 at least. Liberica Full JDK 8 or later is recommended.
## JVM Options (for debugging)
|Parameter|Description|
|---------|-----------|
|`-Dhmcl.self_integrity_check.disable=true`|Bypass the self integrity check when checking for update.|
|`-Dhmcl.bmclapi.override=<version>`|Override api root of BMCLAPI download provider, defaults to `https://bmclapi2.bangbang93.com`. e.g. `https://download.mcbbs.net`.|
|`-Dhmcl.font.override=<font family>`|Override font family.|
|`-Dhmcl.version.override=<version>`|Override the version number.|
|`-Dhmcl.update_source.override=<url>`|Override the update source.|
|`-Dhmcl.authlibinjector.location=<path>`|Use specified authlib-injector (instead of downloading one).|
|`-Dhmcl.openjfx.repo=<maven repository url>`|Add custom maven repository for download OpenJFX.|
|`-Dhmcl.native.encoding=<encoding>`|Override the native encoding.|
|`-Dhmcl.microsoft.auth.id=<App ID>`|Override Microsoft OAuth App ID.|
|`-Dhmcl.microsoft.auth.secret=<App Secret>`|Override Microsoft OAuth App secret.|
| Parameter | Description |
| -------------------------------------------- | ------------------------------------------------------------ |
| `-Dhmcl.self_integrity_check.disable=true` | Bypass the self integrity check when checking for update. |
| `-Dhmcl.bmclapi.override=<version>` | Override API Root of BMCLAPI download provider, defaults to `https://bmclapi2.bangbang93.com`. e.g. `https://download.mcbbs.net`. |
| `-Dhmcl.font.override=<font family>` | Override font family. |
| `-Dhmcl.version.override=<version>` | Override the version number. |
| `-Dhmcl.update_source.override=<url>` | Override the update source. |
| `-Dhmcl.authlibinjector.location=<path>` | Use specified authlib-injector (instead of downloading one). |
| `-Dhmcl.openjfx.repo=<maven repository url>` | Add custom Maven repository for download OpenJFX. |
| `-Dhmcl.native.encoding=<encoding>` | Override the native encoding. |
| `-Dhmcl.microsoft.auth.id=<App ID>` | Override Microsoft OAuth App ID. |
| `-Dhmcl.microsoft.auth.secret=<App Secret>` | Override Microsoft OAuth App secret. |
+59
View File
@@ -0,0 +1,59 @@
# ⛏ Hello Minecraft! Launcher 💎
[![Build Status](https://ci.huangyuhui.net/job/HMCL/badge/icon?.svg)](https://ci.huangyuhui.net/job/HMCL)
![Downloads](https://img.shields.io/github/downloads/huanghongxun/HMCL/total)
![Stars](https://img.shields.io/github/stars/huanghongxun/HMCL)
[![Discord](https://img.shields.io/discord/995291757799538688.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/jVvC7HfM6U)
[![KOOK](https://img.shields.io/badge/KOOK-HMCL-brightgreen)](https://kook.top/Kx7n3t)
[English](https://github.com/huanghongxun/HMCL/blob/javafx/README.md) | 中文
## 简介
HMCL 是一款 Minecraft 启动器, 支持 Mod 管理, 游戏自定义, 游戏自动安装 (Forge, Fabric, LiteLoader 与 OptiFine), 模组包创建, 界面自定义等功能.
不提供插件 API.
## 下载
请从 [HMCL 官网](https://hmcl.huangyuhui.net/download)下载最新版本的 HMCL.
注: 在 GitHub 发布的最新版 HMCL 为测试版, 与官网上发布的正式版相比, 它们包含额外的测试功能. 但是, 它们相较于正式版更不稳定, 您更有可能在使用测试版的过程中遇到 Bug 或意外问题.
虽然并不强制, 但仍建议通过 HMCL 官网下载启动器.
## 开源协议
该程序在 [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html) 开源协议下发布, 同时附有附加条款.
### 附加条款 (依据 GPLv3 开源协议第七条)
1. 当您分发该程序的修改版本时, 您必须以一种合理的方式修改该程序的名称或版本号, 以示其与原始版本不同. (依据 [GPLv3, 7(c)](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L372-L374))
该程序的名称及版本号可在[此处](https://github.com/huanghongxun/HMCL/blob/javafx/HMCL/src/main/java/org/jackhuang/hmcl/Metadata.java#L33-L35)修改.
2. 您不得移除该程序所显示的版权声明. (依据 [GPLv3, 7(b)](https://github.com/huanghongxun/HMCL/blob/11820e31a85d8989e41d97476712b07e7094b190/LICENSE#L368-L370))
## 贡献
如果您想提交一个 Pull Request, 必须遵守如下要求:
* IDE: Intellij IDEA
* 编译器: Java 1.8
* **不要**修改 `gradle` 相关文件
### 编译
于项目根目录执行以下命令:
```bash
./gradlew clean build
```
请确保您至少安装了含有 JavaFX 8 的 Java. 建议使用 Liberica Full JDK 8 或更高版本.
## JVM 选项 (用于调试)
| 参数 | 简介 |
| -------------------------------------------- | ------------------------------------------- |
| `-Dhmcl.self_integrity_check.disable=true` | 检查更新时绕过本体完整性检查. |
| `-Dhmcl.bmclapi.override=<version>` | 覆盖 BMCLAPI 的 API Root, 默认值为 `https://bmclapi2.bangbang93.com`. 例如 `https://download.mcbbs.net`. |
| `-Dhmcl.font.override=<font family>` | 覆盖字族. |
| `-Dhmcl.version.override=<version>` | 覆盖版本号. |
| `-Dhmcl.update_source.override=<url>` | 覆盖更新源. |
| `-Dhmcl.authlibinjector.location=<path>` | 使用指定的 authlib-injector (而非下载一个). |
| `-Dhmcl.openjfx.repo=<maven repository url>` | 添加用于下载 OpenJFX 的自定义 Maven 仓库 |
| `-Dhmcl.native.encoding=<encoding>` | 覆盖原生编码. |
| `-Dhmcl.microsoft.auth.id=<App ID>` | 覆盖 Microsoft OAuth App ID. |
| `-Dhmcl.microsoft.auth.secret=<App Secret>` | 覆盖 Microsoft OAuth App 密钥. |