Skip to content

Commit

Permalink
Merge branch 'javafx' into zkitefly/logs-fix
Browse files Browse the repository at this point in the history
# Conflicts:
#	HMCL/src/main/resources/assets/lang/I18N_es.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
  • Loading branch information
burningtnt committed Jan 8, 2024
2 parents f449029 + e6e4e36 commit 5c709c1
Show file tree
Hide file tree
Showing 90 changed files with 1,851 additions and 680 deletions.
89 changes: 35 additions & 54 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,55 @@
name: Bug Feedback
name: Bug 反馈 | Bug Feedback
description:
反馈一个错误。
为了提高反馈效率,请优先在 KOOK、赞助频道或者 Discord 频道中反馈。若确认是 HMCL 问题,请发布 issue。
反馈一个 HMCL 错误。| Bug Feedback.
title: "[Bug] "
labels: bug
body:
- type: markdown
attributes:
value: |
提交前请确保你的启动器版本是**最新的开发版**,可以在启动器设置中更换更新通道至开发版获取更新。
提交前请确认:
* 该问题确实是 **HMCL 的错误**,而**不是 Minecraft 非正常退出**,如果你的 Minecraft 非正常退出,请前往 [KOOK 频道](https://kook.top/Kx7n3t) 或 [Discord 频道](https://discord.gg/jVvC7HfM6U) 中获取帮助。
* 你的启动器版本是**最新的快照版本**,可以点击 [此处](https://github.com/burningtnt/HMCL-Snapshot-Update/raw/master/datas/HMCL-dev.jar) 下载最新快照版本。
我们发现,对于不经常检查邮箱的人来说,GitHub Issues 的反馈效率太低,时隔几个小时甚至一天的情况很多。
为了改善反馈效率,并将积极为 HMCL 提供问题反馈和建议的人聚集起来,我们希望在这里反馈的人可以在
[KOOK 频道](https://kook.top/Kx7n3t) 或 [Discord 频道](https://discord.gg/jVvC7HfM6U)中反馈信息,
**而不在 GitHub Issues 中反馈问题**。

如果你希望在 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.3.211
validations:
required: true
如果你的问题并不属于上述两类,你可以选取另一种 Issue 类型,或者直接前往 [KOOK 频道](https://kook.top/Kx7n3t) 或 [Discord 频道](https://discord.gg/jVvC7HfM6U) 中获取帮助。
如果你希望在 QQ 群中反馈问题,请 [赞助 HMCL](https://hmcl.huangyuhui.net/api/redirect/sponsor) 后申请加入群聊,也请将下面的信息表填好直接发在群中,加快我们的沟通速度。

Before submitting, please confirm:
* The issue is indeed **an error of HMCL**, not **Minecraft abnormal exit**. If your Minecraft exits abnormally, please go to the [KOOK channel](https://kook.top/Kx7n3t) or [Discord channel](https://discord.gg/jVvC7HfM6U) for help.
* Your launcher version is **the latest snapshot version**. You can click [here](https://github.com/burningtnt/HMCL-Snapshot-Update/raw/master/datas/HMCL-dev.jar) to download the latest snapshot version.

If your issue does not fall into the above two categories, you can choose another type of issue or directly go to the [KOOK channel](https://kook.top/Kx7n3t) or [Discord channel](https://discord.gg/jVvC7HfM6U) for help.
If you want to report a problem in the QQ group, please [sponsor HMCL](https://hmcl.huangyuhui.net/api/redirect/sponsor) and apply to join the group chat. Please also fill in the information form below and send it directly in the group to speed up our communication.
- type: input
id: platform
attributes:
label: 平台 Platform
label: 平台 | Platform
description: 请输入您遇到 BUG 的平台。 Please enter the platform on which you encountered the bug.
placeholder: e.g. Windows 11
validations:
required: true
- type: textarea
id: bug-report
attributes:
label: 问题描述 Problem Description
description: 请尽可能地详细描述问题,特别是您是怎么遇到这个 BUG 的。 Please describe the problem in as much detail as possible, especially how you encountered this bug.
label: 问题描述 | Problem Description
description: 请尽可能地详细描述你所遇到的问题,并描述如何重新触发这个问题。 Please describe the problem you met in as much detail as possible. Besides, please describe how to trigger this problem again.
placeholder: |
1. 点击 HMCL 上的某个按钮 | Click a button named ...
2. 向下翻页 | Scroll down
3. ...
validations:
required: true
- type: input
id: java-version
attributes:
label: Java
description: 请输入您所使用的 Java 的名称与版本。 Please enter the name and version of Java you are using.
placeholder: e.g. LibericaJDK Full JDK 17.0.1
- type: input
id: game-version
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.19
- type: input
id: game-modify
attributes:
label: 对游戏所做的修改 Modifications Made to the Game
description: 如果您为游戏安装了 OptiFine、Forge,或者是其他的 mod,请将您所做的修改填入下方。 If you have OptiFine, Forge, or other mods installed for the game, please enter your modifications below.
placeholder: e.g. OptiFine HD_U_G9, Rift
- type: textarea
id: game-crash-report
attributes:
label: 游戏崩溃报告 Game Crash Report
description: 如果有游戏崩溃报告的话,请填入(或将文件拖入)下方。 If there is a game crash report, please fill in (or drag the file into) below.
- type: textarea
id: hmcl-crash-report
attributes:
label: 启动器崩溃报告 Launcher Crash Report
description: 如果有启动器崩溃报告的话,请填入(或将文件拖入)下方。 If there is a launcher crash report, please fill it in (or drag the file in) below.
- type: textarea
id: hmcl-logs
attributes:
label: 启动器日志文件 Launcher Log File
description: 遇到问题后,请在启动器的【设置】>【通用】>【调试】一栏中点击“导出启动器日志”,并将导出的日志拖到下方的输入栏中。 After encountering a problem, please click "Export Launcher Log" in the [Settings] > [General] > [Debug] column of the launcher, and drag the exported log to the input field below.

id: hmcl-crash-report-or-logs
attributes:
label: 启动器崩溃报告 / 启动器日志文件 | Launcher Crash Report / Launcher Log File
description: |
如果您的启动器崩溃了,请将崩溃报告填入(或将文件拖入)下方。
如果您的启动器没有崩溃,请在遇到问题后不要退出启动器,在启动器的【设置】>【通用】>【调试】一栏中点击“导出启动器日志”,并将导出的日志拖到下方的输入栏中。
**请注意:启动器崩溃报告或日志文件是诊断问题的重要依据,请务必上传!**
If your launcher crashes, please fill it in (or drag the file in) below.
If your launcher doesn't crash, please DO NOT EXIT your launcher, click "Export Launcher Log" in the [Settings] > [General] > [Debug] column of the launcher, and drag the exported log to the input field below.
**Attention: The crash report or the log file is the key to solve the problem. Please update it!**
validations:
required: true
18 changes: 9 additions & 9 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: KOOK 频道
- name: KOOK 频道 | KOOK Channel
url: https://kook.top/Kx7n3t
about: Hello Minecraft! Launcher 的官方 KOOK 频道。
- name: Discord 频道
about: Hello Minecraft! Launcher 的官方 KOOK 频道。| The official KOOK channel of Hello Minecraft! Laucher.
- name: Discord 频道 | Discord Channel
url: https://discord.gg/jVvC7HfM6U
about: Hello Minecraft! Launcher 的官方 Discord 频道。
- name: 赞助通道
about: Hello Minecraft! Launcher 的官方 Discord 频道。| The official Discord channel of Hello Minecraft! Launcher.
- name: 赞助通道 | Sponsorship channel
url: https://afdian.net/@huanghongxun
about: 前往爱发电赞助 HMCL赞助后可以申请加入官方 QQ 群反馈问题。
- name: 其他反馈
about: 前往爱发电赞助 HMCL赞助后可以申请加入官方 QQ 群反馈问题。| Sponsor Hello Minecraft! Launcher on afdian.net and you can apply to join the official QQ group.
- name: 其他反馈 | Others
url: https://github.com/huanghongxun/HMCL/discussions/new/choose
about: 通过 Discussions 反馈其他问题。
about: 通过 Discussions 反馈其他问题。| Report other problems in Discussions.
21 changes: 11 additions & 10 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
name: "Feature Request"
description: "为 HMCL 提出新功能"
labels: feature request
name: 新功能 | Feature Request
description: 为 HMCL 提出新功能 | A new feature for HMCL
title: "[Feature] "
labels: enhancement
body:
- type: markdown
attributes:
value: "提交前请确保查看 issues 列表是否有重复的项目!"
value: 请确认 Issues 列表无重复的项目。| Please make sure that no duplicated issues has already been delivered.
- type: textarea
id: "yml-2"
id: description
attributes:
label: 描述 Description
description: "详细描述你想加入的新功能"
label: 描述 | Description
description: 请详细描述你想加入的新功能。| Please describe the new feature detaily.
validations:
required: true
- type: textarea
id: "yml-3"
id: reason
attributes:
label: 原因 Why
description: "描述该功能带来的好处及原因"
label: 原因 | Reason
description: 请描述该功能带来的好处及原因。| Please describe why you want to add the feature into HMCL.
validations:
required: true
74 changes: 72 additions & 2 deletions HMCL/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.google.gson.Gson
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import java.net.URI
import java.nio.file.FileSystems
import java.nio.file.Files
Expand All @@ -7,12 +10,23 @@ import java.security.Signature
import java.security.spec.PKCS8EncodedKeySpec
import java.util.zip.ZipFile

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath("com.google.code.gson:gson:2.10.1")
}
}

plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}

val isOfficial = System.getenv("HMCL_SIGNATURE_KEY") != null
|| (System.getenv("GITHUB_REPOSITORY_OWNER") == "huanghongxun" && System.getenv("GITHUB_BASE_REF").isNullOrEmpty())
|| (System.getenv("GITHUB_REPOSITORY_OWNER") == "huanghongxun" && System.getenv("GITHUB_BASE_REF")
.isNullOrEmpty())

val buildNumber = System.getenv("BUILD_NUMBER")?.toInt().let { number ->
val offset = System.getenv("BUILD_NUMBER_OFFSET")?.toInt() ?: 0
Expand Down Expand Up @@ -80,6 +94,62 @@ fun attachSignature(jar: File) {
}
}

tasks.getByName<JavaCompile>("compileJava") {
dependsOn(tasks.create("computeDynamicResources") {
this@create.inputs.file(rootProject.rootDir.toPath().resolve("data-json/dynamic-remote-resources-raw.json"))
this@create.outputs.file(rootProject.rootDir.toPath().resolve("data-json/dynamic-remote-resources.json"))

doLast {
Gson().also { gsonInstance ->
Files.newBufferedReader(
rootProject.rootDir.toPath().resolve("data-json/dynamic-remote-resources-raw.json"),
Charsets.UTF_8
).use { br ->
(gsonInstance.fromJson(br, JsonElement::class.java) as JsonObject)
}.also { data ->
data.asMap().forEach { (namespace, namespaceData) ->
(namespaceData as JsonObject).asMap().forEach { (name, nameData) ->
(nameData as JsonObject).asMap().forEach { (version, versionData) ->
require(versionData is JsonObject)
val localPath =
(versionData.get("local_path") as com.google.gson.JsonPrimitive).asString
val sha1 = (versionData.get("sha1") as com.google.gson.JsonPrimitive).asString

val currentSha1 = digest(
"SHA-1",
Files.readAllBytes(rootProject.rootDir.toPath().resolve(localPath))
).joinToString(separator = "") { "%02x".format(it) }

if (!sha1.equals(currentSha1, ignoreCase = true)) {
throw IllegalStateException("Mismatched SHA-1 in $.${namespace}.${name}.${version} of dynamic remote resources detected. Require ${currentSha1}, but found $sha1")
}
}
}
}

rootProject.rootDir.toPath().resolve("data-json/dynamic-remote-resources.json").also { zippedPath ->
gsonInstance.toJson(data).also { expectedData ->
if (Files.exists(zippedPath)) {
Files.readString(zippedPath, Charsets.UTF_8).also { rawData ->
if (!rawData.equals(expectedData)) {
if (System.getenv("GITHUB_SHA") == null) {
Files.writeString(zippedPath, expectedData, Charsets.UTF_8)
} else {
throw IllegalStateException("Mismatched zipped dynamic-remote-resources json file!")
}
}
}
} else {
Files.writeString(zippedPath, expectedData, Charsets.UTF_8)
}
}
}
}
}
}
})
}

val java11 = sourceSets.create("java11") {
java {
srcDir("src/main/java11")
Expand Down Expand Up @@ -108,10 +178,10 @@ tasks.getByName<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("sha
archiveClassifier.set(null as String?)

exclude("**/package-info.class")
exclude("META-INF/maven/**")

minimize {
exclude(dependency("com.google.code.gson:.*:.*"))
exclude(dependency("com.github.steveice10:.*:.*"))
exclude(dependency("libs:JFoenix:.*"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import javafx.scene.transform.Scale;
import javafx.scene.transform.Translate;

import org.jackhuang.hmcl.ui.FXUtils;
import org.jetbrains.annotations.Nullable;

public class SkinCanvas extends Group {

public static final Image ALEX = new Image("/assets/img/skin/alex.png");
public static final Image STEVE = new Image("/assets/img/skin/steve.png");
public static final Image ALEX = FXUtils.newBuiltinImage("/assets/img/skin/alex.png");
public static final Image STEVE = FXUtils.newBuiltinImage("/assets/img/skin/steve.png");

public static final SkinCube ALEX_LARM = new SkinCube(3, 12, 4, 14F / 64F, 16F / 64F, 32F / 64F, 48F / 64F, 0F, true);
public static final SkinCube ALEX_RARM = new SkinCube(3, 12, 4, 14F / 64F, 16F / 64F, 40F / 64F, 16F / 64F, 0F, true);
Expand Down
Loading

0 comments on commit 5c709c1

Please sign in to comment.