Compare commits

...
49 Commits
Author SHA1 Message Date
Glavo 67432bf614 Add cooldown to launch button action (#5759) 2026-03-08 22:14:40 +08:00
辞庐 378c06656d fix: 无法导入部分 Modrinth 整合包 (#5669) 2026-03-08 22:09:45 +08:00
辞庐 e2d6904269 fix: 游戏进程是 Java 11 以下时无法导出游戏运行栈 (#5662) 2026-03-08 22:09:29 +08:00
辞庐 8ef2f8be1b 修正运行路径非法字符 = 提示 (#5737) 2026-03-08 22:06:48 +08:00
辞庐 584f0f39bc 优化安装实例时自动补全模组加载器名称 (#5698) 2026-03-08 22:05:23 +08:00
辞庐 6529a3bb03 fix: 导出游戏运行栈不兼容 Tooltip 未正确展示 (#5659) 2026-03-08 22:05:01 +08:00
辞庐 0e6f43ccba feat: 支持键盘↑↓选择 LineSelectButton (#5636)
resolves #5452
2026-03-08 22:04:01 +08:00
Glavo 94b10a8b29 将 -jfx-toggle-line-color 调整为 -monet-secondary-container (#5760) 2026-03-08 21:48:03 +08:00
辞庐 dc60af6d96 移除下载页面超链接多余 tooltip (#5739) 2026-03-08 21:47:49 +08:00
辞庐andGlavo 272c5d1b57 转换 Curseforge 整合包元数据为 Record (#5625)
Co-authored-by: Glavo <zjx001202@gmail.com>
2026-03-08 21:35:17 +08:00
辞庐 5bfe945fd0 Bump Gradle to 9.4.0 (#5731) 2026-03-08 20:56:19 +08:00
mineDiamond 3e8a295cf2 feat: 添加新版本存档数据获取支持 (#5675)
在[26.1-snapshot-6](https://zh.minecraft.wiki/w/Java%E7%89%8826.1-snapshot-6)中,mojang对整个[存档格式](https://zh.minecraft.wiki/w/Java%E7%89%88%E5%AD%98%E6%A1%A3%E6%A0%BC%E5%BC%8F)和[存档基础数据存储格式](https://zh.minecraft.wiki/w/%E5%AD%98%E6%A1%A3%E5%9F%BA%E7%A1%80%E6%95%B0%E6%8D%AE%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F)进行了非常深的破坏性变更,这导致HMCL几乎无法正确读取新版本的世界数据,本PR将添加对新版本的新格式支持

此PR与 #5419 实现的功能一致,但是使用OpenNBT。

close https://github.com/HMCL-dev/HMCL/issues/5436
2026-03-08 12:49:36 +00:00
辞庐 0d717b84c4 清理 WizardNavigationResult (#5665) 2026-03-07 21:27:17 +08:00
辞庐 13672a57ff fix: #5682 安装整合包界面文件名重复的提示显示不全 (#5691) 2026-03-07 21:25:54 +08:00
MovTery b19151a811 fix: 导出 Modrinth 整合包时,不要求填写作者 (#5710) 2026-03-07 21:18:02 +08:00
辞庐 c7d9bc696a 优化 LineSelectButton Popup Label 配色 (#5707) 2026-03-07 21:15:31 +08:00
辞庐 f426ea48fa 整合包安装页面 文件名 -> 游戏实例名 (#5692) 2026-03-07 20:52:04 +08:00
辞庐 8b9eeb68f7 修正 BAT 脚本限制为 32767 (#5697)
Close #4044
2026-03-07 20:51:09 +08:00
辞庐 413069d334 fix: LineComponent 副标题样式未正确应用 (#5706) 2026-03-07 20:46:57 +08:00
Calboot bab81da466 [Enhancement] ScrollBar 圆角 (#5716) 2026-03-07 20:43:26 +08:00
Hommam-Prom 1138d063d2 Arabic Translition Update (#5714)
15 Ramadan 1447 - 5 March 2026
By Hommam-Prom
2026-03-07 20:39:43 +08:00
Glavo 041eedb765 Bump jetbrains-annotations to 26.1.0 (#5717) 2026-03-06 18:38:52 +08:00
辞庐 48046cd416 fix: SpinnerPane 裁切元素 (#5693) 2026-03-03 21:46:44 +08:00
辞庐 9372c0903c 优化 FileSelector 按钮样式 (#5690) 2026-03-03 21:42:12 +08:00
辞庐 ee79c50dea fix: 手动取消模组更新检查会弹窗操作失败 (#5705) 2026-03-03 21:37:47 +08:00
辞庐 ef3c1b8926 fix: MicrosoftAccountLoginPane 缺少 HEADER (#5656) 2026-02-26 21:51:51 +08:00
Wulian233 ade057b819 Fix 5651: 世界管理不应展示 .zip 文件的世界 (#5652) 2026-02-26 21:50:46 +08:00
TNTyep520andGlavo 2b1de479e5 feat (版本列表): 添加 1.21.11-rc3_unobfuscated. (#5655)
Co-authored-by: Glavo <zjx001202@gmail.com>
2026-02-26 21:50:07 +08:00
辞庐 5502a4efad feat: 切换实例隔离设置后自动刷新其他子页面 (#5638) 2026-02-26 21:48:50 +08:00
Wulian233 5c36c00479 修复语言为文言时下载游戏的选择模组加载器页面的版本号未本地化的问题 (#5359) 2026-02-26 21:29:42 +08:00
辞庐 bb92b5ff8a fix: 选择角色弹窗未适配深色模式 (#5605) 2026-02-26 21:19:13 +08:00
3gf8jv4dv 8b90464d30 chore: update copyright year and attribution (#5622) 2026-02-26 21:16:15 +08:00
Calboot aaea473325 [Bugfix] Fix #5421: 修复部分滚动页面滚动时圆角消失的问题 (#5463)
Fixes #5421
2026-02-25 21:31:50 +08:00
3gf8jv4dv e8f9f093f4 chore(l10n): refine tradchinese (#5623) 2026-02-25 21:17:41 +08:00
辞庐andCopilot 9dc493dd02 清理 ToggleButton 4 创建 (#5630)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-25 21:17:06 +08:00
辞庐 5cf142df0e fix: message.question 未本地化 (#5633) 2026-02-24 21:45:19 +08:00
Glavo 2a6cd17a3c 重新启用 MCIM 加速 (#5030) 2026-02-24 21:21:46 +08:00
Calboot 285e361a5f [Enhancement] 下载界面简介不滚动 (#5458) 2026-02-23 22:00:52 +08:00
辞庐 0b70dc6d22 fix: 本地安装整合包报错 (#5613) 2026-02-23 21:54:56 +08:00
DimeandGlavo c8e2802373 feat: 给大部分直角图标变为圆角图标 (#5554)
Co-authored-by: Glavo <zjx001202@gmail.com>
2026-02-23 21:54:07 +08:00
Glavo 9ac32a308a FetchTask 在重试前添加等待延迟 (#5603) 2026-02-23 21:50:11 +08:00
辞庐 85cc11be1e fix: 账号列表 copy 按钮未正确应用样式 (#5607) 2026-02-23 20:47:53 +08:00
Xirrenandxirren 568fa354ee 清理OAuth Secret相关 (#5614)
Co-authored-by: xirren <xirren@outlook.com>
2026-02-23 20:45:10 +08:00
辞庐 2728be1014 清理 Decorator (#5618) 2026-02-23 20:41:24 +08:00
Glavo 388473850d Add support for Minecraft 26.1-snapshot-8+ to the linux-loongarch64 platform (#5624) 2026-02-23 16:20:35 +08:00
辞庐 1a5b19e7fe fix: JFXSpinner 样式失效 (#5617) 2026-02-23 07:39:24 +08:00
3gf8jv4dv 8d3fa105f7 docs(readme): update contributor count (#5621) 2026-02-23 03:36:48 +08:00
Glavo ed43c07d88 优化设备代码流登录流程 (#5610) 2026-02-22 13:33:53 +08:00
辞庐 586dee4f1b 清理 CrashReporter (#5599) 2026-02-21 23:13:57 +08:00
90 changed files with 1844 additions and 1575 deletions

No files matched your search

-1
View File
@@ -27,7 +27,6 @@ jobs:
run: ./gradlew build --no-daemon --parallel
env:
MICROSOFT_AUTH_ID: ${{ secrets.MICROSOFT_AUTH_ID }}
MICROSOFT_AUTH_SECRET: ${{ secrets.MICROSOFT_AUTH_SECRET }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
- name: Get short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
@@ -128,7 +128,7 @@ public class JFXSpinner extends ProgressIndicator {
@Override
public StyleableDoubleProperty getStyleableProperty(JFXSpinner control) {
return control.radius;
return control.radiusProperty();
}
};
@@ -142,7 +142,7 @@ public class JFXSpinner extends ProgressIndicator {
@Override
public StyleableDoubleProperty getStyleableProperty(JFXSpinner control) {
return control.startingAngle;
return control.startingAngleProperty();
}
};
@@ -214,7 +214,7 @@ public class JFXSpinnerSkin extends SkinBase<JFXSpinner> {
@Override
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) {
final double strokeWidth = arc.getStrokeWidth();
final double radius = Math.min(contentWidth, contentHeight) / 2 - strokeWidth / 2;
double radius = control.getRadius();
final double arcSize = snapSizeX(radius * 2 + strokeWidth);
arcPane.resizeRelocate((contentWidth - arcSize) / 2 + 1, (contentHeight - arcSize) / 2 + 1, arcSize, arcSize);
@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.ui;
import com.jfoenix.controls.*;
import javafx.animation.Animation;
import javafx.animation.Interpolator;
import javafx.animation.PauseTransition;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
@@ -37,7 +38,6 @@ import javafx.event.EventDispatcher;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.geometry.Bounds;
import javafx.geometry.Pos;
import javafx.geometry.Rectangle2D;
import javafx.scene.Cursor;
import javafx.scene.Node;
@@ -51,7 +51,6 @@ import javafx.scene.input.*;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Rectangle;
@@ -68,6 +67,7 @@ import org.jackhuang.hmcl.task.CacheFileTask;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.ui.animation.AnimationUtils;
import org.jackhuang.hmcl.ui.animation.Motion;
import org.jackhuang.hmcl.ui.construct.IconedMenuItem;
import org.jackhuang.hmcl.ui.construct.MenuSeparator;
import org.jackhuang.hmcl.ui.construct.PopupMenu;
@@ -417,14 +417,6 @@ public final class FXUtils {
return region.getMaxHeight();
}
public static Node limitingSize(Node node, double width, double height) {
StackPane pane = new StackPane(node);
pane.setAlignment(Pos.CENTER);
FXUtils.setLimitWidth(pane, width);
FXUtils.setLimitHeight(pane, height);
return pane;
}
public static void limitCellWidth(ListView<?> listView, ListCell<?> cell) {
ReadOnlyDoubleProperty widthProperty;
@@ -1291,6 +1283,30 @@ public final class FXUtils {
return button;
}
public static JFXButton newToggleButton4(SVG icon, int size) {
JFXButton button = new JFXButton();
button.getStyleClass().add("toggle-icon4");
button.setGraphic(icon.createIcon(size));
return button;
}
public static void setOnActionWithCooldown(ButtonBase button, Runnable action) {
setOnActionWithCooldown(button, action, Motion.SHORT4);
}
public static void setOnActionWithCooldown(ButtonBase button, Runnable action, Duration cooldown) {
button.setOnAction(e -> {
button.setDisable(true);
var pause = new PauseTransition(cooldown);
pause.setOnFinished(event -> button.setDisable(false));
pause.play();
action.run();
e.consume();
});
}
public static Label newSafeTruncatedLabel() {
Label label = new Label();
label.setTextOverrun(OverrunStyle.CENTER_WORD_ELLIPSIS);
@@ -28,16 +28,15 @@ import javafx.css.PseudoClass;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.control.Control;
import javafx.scene.control.Label;
import javafx.scene.control.Skin;
import javafx.scene.control.SkinBase;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseButton;
import javafx.scene.layout.*;
import org.jackhuang.hmcl.download.LibraryAnalyzer;
import org.jackhuang.hmcl.setting.VersionIconType;
import org.jackhuang.hmcl.ui.construct.ImageContainer;
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
import org.jackhuang.hmcl.util.i18n.I18n;
import org.jackhuang.hmcl.util.versioning.GameVersionNumber;
@@ -295,14 +294,14 @@ public class InstallerItem extends Control {
paneWrapper.pseudoClassStateChanged(CARD, control.style == Style.CARD);
if (control.iconType != null) {
ImageView view = new ImageView(control.iconType.getIcon());
Node node = FXUtils.limitingSize(view, 32, 32);
node.setMouseTransparent(true);
node.getStyleClass().add("installer-item-image");
pane.getChildren().add(node);
var imageContainer = new ImageContainer(32);
imageContainer.setImage(control.iconType.getIcon());
imageContainer.setMouseTransparent(true);
imageContainer.getStyleClass().add("installer-item-image");
pane.getChildren().add(imageContainer);
if (control.style == Style.CARD) {
VBox.setMargin(node, new Insets(8, 0, 16, 0));
VBox.setMargin(imageContainer, new Insets(8, 0, 16, 0));
}
}
@@ -348,9 +347,7 @@ public class InstallerItem extends Control {
buttonsContainer.setAlignment(Pos.CENTER);
pane.getChildren().add(buttonsContainer);
JFXButton removeButton = new JFXButton();
removeButton.setGraphic(SVG.CLOSE.createIcon());
removeButton.getStyleClass().add("toggle-icon4");
JFXButton removeButton = FXUtils.newToggleButton4(SVG.CLOSE);
if (control.id.equals(MINECRAFT.getPatchId())) {
removeButton.setVisible(false);
} else {
@@ -415,7 +415,7 @@ public final class LogWindow extends Stage {
if (SystemUtils.supportJVMAttachment()) {
exportDumpButton.setOnAction(e -> getSkinnable().onExportDump(exportDumpPane));
} else {
exportDumpButton.setTooltip(new Tooltip(i18n("logwindow.export_dump.no_dependency")));
FXUtils.installFastTooltip(exportDumpPane, i18n("logwindow.export_dump.no_dependency"));
exportDumpButton.setDisable(true);
}
exportDumpPane.setContent(exportDumpButton);
@@ -125,7 +125,7 @@ public final class AccountListItemSkin extends SkinBase<AccountListItem> {
spinnerMove.setContent(btnMove);
right.getChildren().add(spinnerMove);
JFXButton btnRefresh = new JFXButton();
JFXButton btnRefresh = FXUtils.newToggleButton4(SVG.REFRESH);
SpinnerPane spinnerRefresh = new SpinnerPane();
spinnerRefresh.getStyleClass().setAll("small-spinner-pane");
if (skinnable.getAccount() instanceof MicrosoftAccount && Accounts.OAUTH_CALLBACK.getClientId().isEmpty()) {
@@ -144,13 +144,11 @@ public final class AccountListItemSkin extends SkinBase<AccountListItem> {
})
.start();
});
btnRefresh.getStyleClass().add("toggle-icon4");
btnRefresh.setGraphic(SVG.REFRESH.createIcon());
FXUtils.installFastTooltip(btnRefresh, i18n("button.refresh"));
spinnerRefresh.setContent(btnRefresh);
right.getChildren().add(spinnerRefresh);
JFXButton btnUpload = new JFXButton();
JFXButton btnUpload = FXUtils.newToggleButton4(SVG.CHECKROOM);
SpinnerPane spinnerUpload = new SpinnerPane();
btnUpload.setOnAction(e -> {
Task<?> uploadTask = skinnable.uploadSkin();
@@ -161,29 +159,23 @@ public final class AccountListItemSkin extends SkinBase<AccountListItem> {
.start();
}
});
btnUpload.getStyleClass().add("toggle-icon4");
btnUpload.setGraphic(SVG.CHECKROOM.createIcon());
FXUtils.installFastTooltip(btnUpload, i18n("account.skin.upload"));
btnUpload.disableProperty().bind(Bindings.not(skinnable.canUploadSkin()));
spinnerUpload.setContent(btnUpload);
spinnerUpload.getStyleClass().add("small-spinner-pane");
right.getChildren().add(spinnerUpload);
JFXButton btnCopyUUID = new JFXButton();
JFXButton btnCopyUUID = FXUtils.newToggleButton4(SVG.CONTENT_COPY);
SpinnerPane spinnerCopyUUID = new SpinnerPane();
spinnerCopyUUID.getStyleClass().add("small-spinner-pane");
btnUpload.getStyleClass().add("toggle-icon4");
btnCopyUUID.setOnAction(e -> FXUtils.copyText(skinnable.getAccount().getUUID().toString()));
btnCopyUUID.setGraphic(SVG.CONTENT_COPY.createIcon());
FXUtils.installFastTooltip(btnCopyUUID, i18n("account.copy_uuid"));
spinnerCopyUUID.setContent(btnCopyUUID);
right.getChildren().add(spinnerCopyUUID);
JFXButton btnRemove = new JFXButton();
JFXButton btnRemove = FXUtils.newToggleButton4(SVG.DELETE);
btnRemove.setOnAction(e -> Controllers.confirm(i18n("button.remove.confirm"), i18n("button.remove"), skinnable::remove, null));
btnRemove.getStyleClass().add("toggle-icon4");
BorderPane.setAlignment(btnRemove, Pos.CENTER);
btnRemove.setGraphic(SVG.DELETE.createIcon());
FXUtils.installFastTooltip(btnRemove, i18n("button.delete"));
right.getChildren().add(btnRemove);
root.setRight(right);
@@ -399,9 +399,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
});
linksContainer.setMinWidth(USE_PREF_SIZE);
JFXButton btnAddServer = new JFXButton();
btnAddServer.setGraphic(SVG.ADD.createIcon(20));
btnAddServer.getStyleClass().add("toggle-icon4");
JFXButton btnAddServer = FXUtils.newToggleButton4(SVG.ADD, 20);
btnAddServer.setOnAction(e -> {
Controllers.dialog(new AddAuthlibInjectorServerPane());
});
@@ -566,7 +564,7 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
}
}
private static class DialogCharacterSelector extends BorderPane implements CharacterSelector {
public static class DialogCharacterSelector extends JFXDialogLayout implements CharacterSelector {
private final AdvancedListBox listBox = new AdvancedListBox();
private final JFXButton cancel = new JFXButton();
@@ -578,17 +576,17 @@ public class CreateAccountPane extends JFXDialogLayout implements DialogAware {
setStyle("-fx-padding: 8px;");
cancel.setText(i18n("button.cancel"));
StackPane.setAlignment(cancel, Pos.BOTTOM_RIGHT);
cancel.setOnAction(e -> latch.countDown());
cancel.getStyleClass().add("dialog-cancel");
listBox.startCategory(i18n("account.choose").toUpperCase(Locale.ROOT));
setCenter(listBox);
setBody(listBox);
HBox hbox = new HBox();
hbox.setAlignment(Pos.CENTER_RIGHT);
hbox.getChildren().add(cancel);
setBottom(hbox);
setActions(hbox);
onEscPressed(this, cancel::fire);
}
@@ -1,3 +1,20 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2026 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.account;
import com.jfoenix.controls.JFXButton;
@@ -175,16 +192,20 @@ public class MicrosoftAccountLoginPane extends JFXDialogLayout implements Dialog
} else if (currentStep instanceof Step.WaitForScanQrCode wait) {
loginButtonSpinner.setLoading(true);
String scanUri = "https://www.microsoft.com/link".equals(wait.verificationUri())
? "https://www.microsoft.com/link?otc=" + wait.userCode()
: wait.verificationUri();
var deviceHint = new HintPane(MessageDialogPane.MessageType.INFO);
deviceHint.setSegment(i18n("account.methods.microsoft.methods.device.hint",
StringUtils.escapeXmlAttribute(wait.verificationUri()),
StringUtils.escapeXmlAttribute(scanUri),
wait.verificationUri(),
wait.userCode()
));
var qrCode = new SVGPath();
qrCode.fillProperty().bind(Themes.colorSchemeProperty().getPrimary());
qrCode.setContent(QrCodeUtils.toSVGPath(QrCode.encodeText(wait.verificationUri() + "?otc=" + wait.userCode(), QrCode.Ecc.MEDIUM)));
qrCode.setContent(QrCodeUtils.toSVGPath(QrCode.encodeText(scanUri, QrCode.Ecc.MEDIUM)));
qrCode.setScaleX(3);
qrCode.setScaleY(3);
@@ -17,7 +17,6 @@
*/
package org.jackhuang.hmcl.ui.construct;
import com.jfoenix.controls.JFXButton;
import javafx.beans.property.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
@@ -85,13 +84,11 @@ public class AdvancedListItem extends Control {
}
public void setRightAction(SVG icon, Runnable action) {
var button = new JFXButton();
var button = FXUtils.newToggleButton4(icon, 14);
button.setOnAction(e -> {
action.run();
e.consume();
});
button.getStyleClass().add("toggle-icon4");
button.setGraphic(icon.createIcon(14));
setAlignment(button, Pos.CENTER);
setRightGraphic(button);
}
@@ -80,8 +80,7 @@ public class FileSelector extends HBox {
JFXTextField customField = new JFXTextField();
FXUtils.bindString(customField, valueProperty());
JFXButton selectButton = new JFXButton();
selectButton.setGraphic(SVG.FOLDER_OPEN.createIcon(15));
JFXButton selectButton = FXUtils.newToggleButton4(SVG.FOLDER_OPEN, 15);
selectButton.setOnAction(e -> {
if (directory) {
DirectoryChooser chooser = new DirectoryChooser();
@@ -129,12 +129,12 @@ public class FloatScrollBarSkin implements Skin<ScrollBar> {
track.heightProperty().unbind();
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
track.relocate(0, -5);
track.relocate(0, -8);
track.widthProperty().bind(scrollBar.widthProperty());
track.setHeight(5);
track.setHeight(8);
} else {
track.relocate(-5, 0);
track.setWidth(5);
track.relocate(-8, 0);
track.setWidth(8);
track.heightProperty().bind(scrollBar.heightProperty());
}
@@ -144,13 +144,13 @@ public class FloatScrollBarSkin implements Skin<ScrollBar> {
thumb.heightProperty().unbind();
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
thumb.relocate(0, -5);
thumb.relocate(0, -8);
thumb.widthProperty().bind(Bindings.max(20, scrollBar.visibleAmountProperty().divide(range).multiply(scrollBar.widthProperty())));
thumb.setHeight(5);
thumb.setHeight(8);
thumb.xProperty().bind(Bindings.subtract(scrollBar.widthProperty(), thumb.widthProperty()).multiply(position));
} else {
thumb.relocate(-5, 0);
thumb.setWidth(5);
thumb.relocate(-8, 0);
thumb.setWidth(8);
thumb.heightProperty().bind(Bindings.max(20, scrollBar.visibleAmountProperty().divide(range).multiply(scrollBar.heightProperty())));
thumb.yProperty().bind(Bindings.subtract(scrollBar.heightProperty(), thumb.heightProperty()).multiply(position));
}
@@ -162,7 +162,7 @@ public class FloatScrollBarSkin implements Skin<ScrollBar> {
return Double.MAX_VALUE;
}
return 5;
return 8;
}
@Override
@@ -171,7 +171,7 @@ public class FloatScrollBarSkin implements Skin<ScrollBar> {
return Double.MAX_VALUE;
}
return 5;
return 8;
}
};
}
@@ -0,0 +1,163 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2026 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 javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.css.CssMetaData;
import javafx.css.Styleable;
import javafx.css.StyleableDoubleProperty;
import javafx.css.StyleableProperty;
import javafx.css.converter.SizeConverter;
import javafx.geometry.Pos;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.scene.shape.Rectangle;
import org.jackhuang.hmcl.ui.FXUtils;
import java.util.ArrayList;
import java.util.List;
/// A custom ImageView with fixed size and corner radius support.
public class ImageContainer extends StackPane {
private static final String DEFAULT_STYLE_CLASS = "image-container";
private final ImageView imageView = new ImageView();
private final Rectangle clip = new Rectangle();
public ImageContainer(double size) {
this(size, size);
}
public ImageContainer(double width, double height) {
this.getStyleClass().add(DEFAULT_STYLE_CLASS);
FXUtils.setLimitWidth(this, width);
FXUtils.setLimitHeight(this, height);
imageView.setPreserveRatio(true);
FXUtils.limitSize(imageView, width, height);
StackPane.setAlignment(imageView, Pos.CENTER);
clip.setWidth(width);
clip.setHeight(height);
updateCornerRadius(getCornerRadius());
this.setClip(clip);
this.getChildren().setAll(imageView);
}
private void updateCornerRadius(double radius) {
clip.setArcWidth(radius);
clip.setArcHeight(radius);
}
private static final double DEFAULT_CORNER_RADIUS = 6.0;
private StyleableDoubleProperty cornerRadius;
public StyleableDoubleProperty cornerRadiusProperty() {
if (this.cornerRadius == null) {
cornerRadius = new StyleableDoubleProperty() {
@Override
public Object getBean() {
return ImageContainer.this;
}
@Override
public String getName() {
return "cornerRadius";
}
@Override
public CssMetaData<? extends Styleable, Number> getCssMetaData() {
return StyleableProperties.CORNER_RADIUS;
}
@Override
protected void invalidated() {
updateCornerRadius(get());
}
};
}
return cornerRadius;
}
public double getCornerRadius() {
return cornerRadius == null ? DEFAULT_CORNER_RADIUS : cornerRadius.get();
}
public void setCornerRadius(double radius) {
cornerRadiusProperty().set(radius);
}
public ObjectProperty<Image> imageProperty() {
return imageView.imageProperty();
}
public Image getImage() {
return imageView.getImage();
}
public void setImage(Image image) {
imageView.setImage(image);
}
public BooleanProperty smoothProperty() {
return imageView.smoothProperty();
}
public boolean isSmooth() {
return imageView.isSmooth();
}
public void setSmooth(boolean smooth) {
imageView.setSmooth(smooth);
}
@Override
public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
return StyleableProperties.STYLEABLES;
}
private static final class StyleableProperties {
private static final CssMetaData<ImageContainer, Number> CORNER_RADIUS =
new CssMetaData<>("-jfx-corner-radius", SizeConverter.getInstance(), DEFAULT_CORNER_RADIUS) {
@Override
public boolean isSettable(ImageContainer control) {
return control.cornerRadius == null || !control.cornerRadius.isBound();
}
@Override
public StyleableProperty<Number> getStyleableProperty(ImageContainer control) {
return control.cornerRadiusProperty();
}
};
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
static {
var styleables = new ArrayList<>(StackPane.getClassCssMetaData());
styleables.add(CORNER_RADIUS);
STYLEABLES = List.copyOf(styleables);
}
}
}
@@ -28,7 +28,6 @@ import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
@@ -40,7 +39,7 @@ import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
@DefaultProperty("image")
public final class ImagePickerItem extends BorderPane {
private final ImageView imageView;
private final ImageContainer imageContainer;
private final StringProperty title = new SimpleStringProperty(this, "title");
private final ObjectProperty<EventHandler<ActionEvent>> onSelectButtonClicked = new SimpleObjectProperty<>(this, "onSelectButtonClicked");
@@ -48,25 +47,20 @@ public final class ImagePickerItem extends BorderPane {
private final ObjectProperty<Image> image = new SimpleObjectProperty<>(this, "image");
public ImagePickerItem() {
imageView = new ImageView();
imageView.setSmooth(false);
imageView.setPreserveRatio(true);
imageContainer = new ImageContainer(32);
imageContainer.setSmooth(false);
JFXButton selectButton = new JFXButton();
selectButton.setGraphic(SVG.EDIT.createIcon(20));
JFXButton selectButton = FXUtils.newToggleButton4(SVG.EDIT, 20);
selectButton.onActionProperty().bind(onSelectButtonClicked);
selectButton.getStyleClass().add("toggle-icon4");
JFXButton deleteButton = new JFXButton();
deleteButton.setGraphic(SVG.RESTORE.createIcon(20));
JFXButton deleteButton = FXUtils.newToggleButton4(SVG.RESTORE, 20);
deleteButton.onActionProperty().bind(onDeleteButtonClicked);
deleteButton.getStyleClass().add("toggle-icon4");
FXUtils.installFastTooltip(selectButton, i18n("button.edit"));
FXUtils.installFastTooltip(deleteButton, i18n("button.reset"));
HBox hBox = new HBox();
hBox.getChildren().setAll(imageView, selectButton, deleteButton);
hBox.getChildren().setAll(imageContainer, selectButton, deleteButton);
hBox.setAlignment(Pos.CENTER_RIGHT);
hBox.setSpacing(8);
setRight(hBox);
@@ -78,7 +72,7 @@ public final class ImagePickerItem extends BorderPane {
vBox.setAlignment(Pos.CENTER_LEFT);
setLeft(vBox);
imageView.imageProperty().bind(image);
imageContainer.imageProperty().bind(image);
}
public String getTitle() {
@@ -128,8 +122,4 @@ public final class ImagePickerItem extends BorderPane {
public void setImage(Image image) {
this.image.set(image);
}
public ImageView getImageView() {
return imageView;
}
}
@@ -20,16 +20,18 @@ package org.jackhuang.hmcl.ui.construct;
import com.jfoenix.controls.JFXPopup;
import javafx.beans.InvalidationListener;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.beans.property.ListProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.css.PseudoClass;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.*;
import javafx.scene.input.*;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.SVG;
import org.jackhuang.hmcl.util.javafx.MappedObservableList;
@@ -81,6 +83,8 @@ public final class LineSelectButton<T> extends LineButton {
PopupMenu popupMenu = new PopupMenu();
this.popup = new JFXPopup(popupMenu);
popupMenu.addEventHandler(KeyEvent.KEY_PRESSED, this::handleKeyEvent);
ripplerContainer.addEventFilter(ScrollEvent.ANY, ignored -> popup.hide());
Bindings.bindContent(popupMenu.getContent(), MappedObservableList.create(itemsProperty(), item -> {
@@ -213,4 +217,32 @@ public final class LineSelectButton<T> extends LineButton {
return items.get();
}
private void handleKeyEvent(KeyEvent event) {
ObservableList<T> list = getItems();
if (list == null || list.isEmpty()) return;
int index = list.indexOf(getValue());
var code = event.getCode();
if (code == KeyCode.UP) {
if (index > 0) {
setValue(list.get(index - 1));
} else {
setValue(list.get(list.size() - 1));
}
event.consume();
} else if (code == KeyCode.DOWN) {
if (index < list.size() - 1) {
setValue(list.get(index + 1));
} else {
setValue(list.get(0));
}
event.consume();
} else if (code == KeyCode.ENTER || code == KeyCode.ESCAPE) {
if (popup != null && popup.isShowing()) {
popup.hide();
event.consume();
}
}
}
}
@@ -189,6 +189,7 @@ public class SpinnerPane extends Control {
Skin(SpinnerPane control) {
super(control);
root.setClip(null);
updateContent();
this.getChildren().setAll(root);
@@ -39,6 +39,7 @@ import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;
import org.jackhuang.hmcl.Launcher;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.animation.AnimationUtils;
import org.jackhuang.hmcl.ui.animation.Motion;
@@ -46,13 +47,10 @@ import org.jackhuang.hmcl.ui.wizard.Navigation;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
public class Decorator extends Control {
private final ListProperty<Node> drawer = new SimpleListProperty<>(FXCollections.observableArrayList());
private final ListProperty<Node> content = new SimpleListProperty<>(FXCollections.observableArrayList());
private final ListProperty<Node> container = new SimpleListProperty<>(FXCollections.observableArrayList());
private final ObjectProperty<Background> contentBackground = new SimpleObjectProperty<>();
private final ObjectProperty<DecoratorPage.State> state = new SimpleObjectProperty<>();
private final StringProperty drawerTitle = new SimpleStringProperty();
private final ObjectProperty<Runnable> onCloseButtonAction = new SimpleObjectProperty<>();
private final ObjectProperty<EventHandler<ActionEvent>> onCloseNavButtonAction = new SimpleObjectProperty<>();
private final ObjectProperty<EventHandler<ActionEvent>> onBackNavButtonAction = new SimpleObjectProperty<>();
private final ObjectProperty<EventHandler<ActionEvent>> onRefreshNavButtonAction = new SimpleObjectProperty<>();
@@ -117,18 +115,6 @@ public class Decorator extends Control {
this.drawerWrapper = drawerWrapper;
}
public ObservableList<Node> getDrawer() {
return drawer.get();
}
public ListProperty<Node> drawerProperty() {
return drawer;
}
public void setDrawer(ObservableList<Node> drawer) {
this.drawer.set(drawer);
}
public ObservableList<Node> getContent() {
return content.get();
}
@@ -153,30 +139,6 @@ public class Decorator extends Control {
this.state.set(state);
}
public String getDrawerTitle() {
return drawerTitle.get();
}
public StringProperty drawerTitleProperty() {
return drawerTitle;
}
public void setDrawerTitle(String drawerTitle) {
this.drawerTitle.set(drawerTitle);
}
public Runnable getOnCloseButtonAction() {
return onCloseButtonAction.get();
}
public ObjectProperty<Runnable> onCloseButtonActionProperty() {
return onCloseButtonAction;
}
public void setOnCloseButtonAction(Runnable onCloseButtonAction) {
this.onCloseButtonAction.set(onCloseButtonAction);
}
public ObservableList<Node> getContainer() {
return container.get();
}
@@ -301,7 +263,26 @@ public class Decorator extends Control {
}
public void close() {
onCloseButtonAction.get().run();
if (AnimationUtils.playWindowAnimation()) {
Timeline timeline = new Timeline(
new KeyFrame(Duration.millis(0),
new KeyValue(opacityProperty(), 1, Motion.EASE),
new KeyValue(scaleXProperty(), 1, Motion.EASE),
new KeyValue(scaleYProperty(), 1, Motion.EASE),
new KeyValue(scaleZProperty(), 0.3, Motion.EASE)
),
new KeyFrame(Duration.millis(200),
new KeyValue(opacityProperty(), 0, Motion.EASE),
new KeyValue(scaleXProperty(), 0.8, Motion.EASE),
new KeyValue(scaleYProperty(), 0.8, Motion.EASE),
new KeyValue(scaleZProperty(), 0.8, Motion.EASE)
)
);
timeline.setOnFinished(event -> Launcher.stopApplication());
timeline.play();
} else {
Launcher.stopApplication();
}
}
public void capableDraggingWindow(Node node) {
@@ -20,9 +20,6 @@ package org.jackhuang.hmcl.ui.decorator;
import com.jfoenix.controls.JFXSnackbar;
import com.jfoenix.controls.JFXSnackbarLayout;
import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.InvalidationListener;
import javafx.beans.WeakInvalidationListener;
import javafx.geometry.Insets;
@@ -37,7 +34,6 @@ import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.stage.Stage;
import javafx.util.Duration;
import org.jackhuang.hmcl.Launcher;
import org.jackhuang.hmcl.Metadata;
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorDnD;
import org.jackhuang.hmcl.setting.EnumBackgroundImage;
@@ -47,7 +43,6 @@ import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.DialogUtils;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.account.AddAuthlibInjectorServerPane;
import org.jackhuang.hmcl.ui.animation.AnimationUtils;
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
import org.jackhuang.hmcl.ui.animation.Motion;
import org.jackhuang.hmcl.ui.animation.TransitionPane.AnimationProducer;
@@ -81,28 +76,6 @@ public class DecoratorController {
public DecoratorController(Stage stage, Node mainPage) {
decorator = new Decorator(stage);
decorator.setOnCloseButtonAction(() -> {
if (AnimationUtils.playWindowAnimation()) {
Timeline timeline = new Timeline(
new KeyFrame(Duration.millis(0),
new KeyValue(decorator.opacityProperty(), 1, Motion.EASE),
new KeyValue(decorator.scaleXProperty(), 1, Motion.EASE),
new KeyValue(decorator.scaleYProperty(), 1, Motion.EASE),
new KeyValue(decorator.scaleZProperty(), 0.3, Motion.EASE)
),
new KeyFrame(Duration.millis(200),
new KeyValue(decorator.opacityProperty(), 0, Motion.EASE),
new KeyValue(decorator.scaleXProperty(), 0.8, Motion.EASE),
new KeyValue(decorator.scaleYProperty(), 0.8, Motion.EASE),
new KeyValue(decorator.scaleZProperty(), 0.8, Motion.EASE)
)
);
timeline.setOnFinished(event -> Launcher.stopApplication());
timeline.play();
} else {
Launcher.stopApplication();
}
});
decorator.titleTransparentProperty().bind(config().titleTransparentProperty());
navigator = new Navigator();
@@ -28,6 +28,7 @@ import org.jackhuang.hmcl.ui.construct.RequiredValidator;
import org.jackhuang.hmcl.ui.construct.Validator;
import org.jackhuang.hmcl.ui.wizard.WizardController;
import org.jackhuang.hmcl.util.SettingsMap;
import org.jackhuang.hmcl.util.i18n.I18n;
import static javafx.beans.binding.Bindings.createBooleanBinding;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
@@ -50,11 +51,11 @@ public class InstallersPage extends AbstractInstallersPage {
@Override
public String getTitle() {
return group.getGame().versionProperty().get().version();
return ((RemoteVersion) controller.getSettings().get("game")).getGameVersion();
}
private String getVersion(String id) {
return ((RemoteVersion) controller.getSettings().get(id)).getSelfVersion();
return I18n.getDisplayVersion((RemoteVersion) controller.getSettings().get(id));
}
protected void reload() {
@@ -111,7 +112,7 @@ public class InstallersPage extends AbstractInstallersPage {
}
private void setTxtNameWithLoaders() {
StringBuilder nameBuilder = new StringBuilder(group.getGame().versionProperty().get().version());
StringBuilder nameBuilder = new StringBuilder(getTitle());
for (InstallerItem library : group.getLibraries()) {
String libraryId = library.getLibraryId().replace(LibraryAnalyzer.LibraryType.MINECRAFT.getPatchId(), "");
@@ -120,23 +121,22 @@ public class InstallersPage extends AbstractInstallersPage {
}
LibraryAnalyzer.LibraryType libraryType = LibraryAnalyzer.LibraryType.fromPatchId(libraryId);
if (libraryType != null) {
String loaderName = switch (libraryType) {
case FORGE -> i18n("install.installer.forge");
case NEO_FORGE -> i18n("install.installer.neoforge");
case CLEANROOM -> i18n("install.installer.cleanroom");
case LEGACY_FABRIC -> i18n("install.installer.legacyfabric").replace(" ", "_");
case FABRIC -> i18n("install.installer.fabric");
case LITELOADER -> i18n("install.installer.liteloader");
case QUILT -> i18n("install.installer.quilt");
case OPTIFINE -> i18n("install.installer.optifine");
case FORGE -> "Forge";
case NEO_FORGE -> "NeoForge";
case CLEANROOM -> "Cleanroom";
case LEGACY_FABRIC -> "LegacyFabric";
case FABRIC -> "Fabric";
case LITELOADER -> "LiteLoader";
case QUILT -> "Quilt";
case OPTIFINE -> "OptiFine";
default -> null;
};
if (loaderName == null)
continue;
nameBuilder.append("-").append(loaderName);
if (loaderName != null)
nameBuilder.append('-').append(loaderName);
}
}
@@ -47,6 +47,7 @@ public final class ModpackInstallWizardProvider implements WizardProvider {
private final Path file;
private final String updateVersion;
private String iconUrl;
private boolean hasSource;
public ModpackInstallWizardProvider(Profile profile) {
this(profile, null, null);
@@ -79,6 +80,7 @@ public final class ModpackInstallWizardProvider implements WizardProvider {
if (StringUtils.isNotBlank(iconUrl))
settings.put(LocalModpackPage.MODPACK_ICON_URL, iconUrl);
settings.put(ModpackPage.PROFILE, profile);
hasSource = settings.containsKey(LocalModpackPage.MODPACK_FILE) || settings.containsKey(RemoteModpackPage.MODPACK_SERVER_MANIFEST);
}
private Task<?> finishModpackInstallingAsync(SettingsMap settings) {
@@ -156,7 +158,6 @@ public final class ModpackInstallWizardProvider implements WizardProvider {
@Override
public Node createPage(WizardController controller, int step, SettingsMap settings) {
boolean hasSource = controller.getSettings().containsKey(LocalModpackPage.MODPACK_FILE) || settings.containsKey(RemoteModpackPage.MODPACK_SERVER_MANIFEST);
if (hasSource) {
return switch (step) {
case 0 -> createModpackInstallPage(controller);
@@ -42,11 +42,11 @@ public abstract class ModpackPage extends SpinnerPane implements WizardPage {
{
var archiveNamePane = new LinePane();
{
archiveNamePane.setTitle(i18n("archive.file.name"));
archiveNamePane.setTitle(i18n("version.name"));
txtModpackName = new JFXTextField();
txtModpackName.setPrefWidth(300);
// FIXME: Validator are not shown properly
FXUtils.setLimitHeight(archiveNamePane, 75);
// BorderPane.setMargin(txtModpackName, new Insets(0, 0, 8, 32));
BorderPane.setAlignment(txtModpackName, Pos.CENTER_RIGHT);
archiveNamePane.setRight(txtModpackName);
@@ -278,10 +278,12 @@ public final class VersionsPage extends Control implements WizardPage, Refreshab
iconType = VersionIconType.COMMAND;
imageView.setImage(iconType.getIcon());
String displayGameVersion = I18n.getDisplayVersion(GameVersionNumber.asGameVersion(remoteVersion.getGameVersion()));
if (twoLineListItem.getSubtitle() == null)
twoLineListItem.setSubtitle(remoteVersion.getGameVersion());
twoLineListItem.setSubtitle(displayGameVersion);
else
twoLineListItem.addTag(remoteVersion.getGameVersion());
twoLineListItem.addTag(displayGameVersion);
}
}
}
@@ -221,10 +221,15 @@ public final class ModpackInfoPage extends Control implements WizardPage {
list.getContent().addAll(
createTextFieldLinePane(i18n("modpack.name"), skinnable.name, new RequiredValidator()),
createTextFieldLinePane(i18n("archive.author"), skinnable.author, new RequiredValidator()),
createTextFieldLinePane(i18n("archive.version"), skinnable.version, new RequiredValidator())
);
if (skinnable.options.isRequireAuthor()) {
list.getContent().add(
createTextFieldLinePane(i18n("archive.author"), skinnable.author, new RequiredValidator())
);
}
if (skinnable.options.isRequireFileApi()) {
list.getContent().add(createTextFieldLinePane(
i18n("modpack.file_api"), skinnable.fileApi,
@@ -241,9 +241,7 @@ public final class JavaManagementPage extends ListPageBase<JavaRuntime> {
HBox right = new HBox();
right.setAlignment(Pos.CENTER_RIGHT);
{
JFXButton revealButton = new JFXButton();
revealButton.setGraphic(SVG.FOLDER_OPEN.createIcon());
revealButton.getStyleClass().add("toggle-icon4");
JFXButton revealButton = FXUtils.newToggleButton4(SVG.FOLDER_OPEN);
revealButton.setOnAction(e -> {
JavaRuntime java = getItem();
if (java != null)
@@ -157,26 +157,20 @@ public final class JavaRestorePage extends ListPageBase<JavaRestorePage.Disabled
HBox right = new HBox();
right.setAlignment(Pos.CENTER_RIGHT);
{
JFXButton revealButton = new JFXButton();
revealButton.getStyleClass().add("toggle-icon4");
revealButton.setGraphic(SVG.FOLDER_OPEN.createIcon());
JFXButton revealButton = FXUtils.newToggleButton4(SVG.FOLDER_OPEN);
revealButton.setOnAction(e -> skinnable.onReveal());
FXUtils.installFastTooltip(revealButton, i18n("reveal.in_file_manager"));
if (skinnable.realPath == null) {
revealButton.setDisable(true);
JFXButton removeButton = new JFXButton();
removeButton.getStyleClass().add("toggle-icon4");
removeButton.setGraphic(SVG.DELETE.createIcon());
JFXButton removeButton = FXUtils.newToggleButton4(SVG.DELETE);
removeButton.setOnAction(e -> skinnable.onRemove());
FXUtils.installFastTooltip(removeButton, i18n("java.disabled.management.remove"));
right.getChildren().setAll(revealButton, removeButton);
} else {
JFXButton restoreButton = new JFXButton();
restoreButton.getStyleClass().add("toggle-icon4");
restoreButton.setGraphic(SVG.RESTORE.createIcon());
JFXButton restoreButton = FXUtils.newToggleButton4(SVG.RESTORE);
restoreButton.setOnAction(e -> skinnable.onRestore());
FXUtils.installFastTooltip(restoreButton, i18n("java.disabled.management.restore"));
@@ -227,7 +227,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
launchLabel.setText(i18n("version.launch.empty"));
currentLabel.setText(null);
graphic.getChildren().setAll(launchLabel);
launchButton.setOnAction(e -> MainPage.this.launchNoGame());
FXUtils.setOnActionWithCooldown(launchButton, MainPage.this::launchNoGame);
if (tooltip == null)
tooltip = new Tooltip(i18n("version.launch.empty.tooltip"));
FXUtils.installFastTooltip(launchButton, tooltip);
@@ -235,7 +235,7 @@ public final class MainPage extends StackPane implements DecoratorPage {
launchLabel.setText(i18n("version.launch"));
currentLabel.setText(currentGame);
graphic.getChildren().setAll(launchLabel, currentLabel);
launchButton.setOnAction(e -> MainPage.this.launch());
FXUtils.setOnActionWithCooldown(launchButton, MainPage.this::launch);
if (tooltip != null)
Tooltip.uninstall(launchButton, tooltip);
}
@@ -226,9 +226,7 @@ public class PersonalizationPage extends StackPane {
.fallbackTo(12.0)
.asPredicate(Validator.addTo(txtLogFontSize)));
JFXButton clearButton = new JFXButton();
clearButton.getStyleClass().add("toggle-icon4");
clearButton.setGraphic(SVG.RESTORE.createIcon());
JFXButton clearButton = FXUtils.newToggleButton4(SVG.RESTORE);
clearButton.setOnAction(e -> cboLogFont.setValue(null));
FXUtils.installFastTooltip(clearButton, i18n("button.reset"));
@@ -276,9 +274,7 @@ public class PersonalizationPage extends StackPane {
cboFont.setValue(config().getLauncherFontFamily());
FXUtils.onChange(cboFont.valueProperty(), FontManager::setFontFamily);
JFXButton clearButton = new JFXButton();
clearButton.getStyleClass().add("toggle-icon4");
clearButton.setGraphic(SVG.RESTORE.createIcon());
JFXButton clearButton = FXUtils.newToggleButton4(SVG.RESTORE);
clearButton.setOnAction(e -> cboFont.setValue(null));
FXUtils.installFastTooltip(clearButton, i18n("button.reset"));
@@ -140,10 +140,8 @@ public final class SettingsPage extends ScrollPane {
}
{
JFXButton btnUpdate = new JFXButton();
JFXButton btnUpdate = FXUtils.newToggleButton4(SVG.UPDATE, 20);
btnUpdate.setOnAction(e -> onUpdate());
btnUpdate.getStyleClass().add("toggle-icon4");
btnUpdate.setGraphic(SVG.UPDATE.createIcon(20));
FXUtils.installFastTooltip(btnUpdate, i18n("update.tooltip"));
updateListener = any -> {
@@ -60,11 +60,9 @@ public class ProfileListItemSkin extends SkinBase<ProfileListItem> {
HBox right = new HBox();
right.setAlignment(Pos.CENTER_RIGHT);
JFXButton btnRemove = new JFXButton();
JFXButton btnRemove = FXUtils.newToggleButton4(SVG.CLOSE, 14);
btnRemove.setOnAction(e -> skinnable.remove());
btnRemove.getStyleClass().add("toggle-icon4");
BorderPane.setAlignment(btnRemove, Pos.CENTER);
btnRemove.setGraphic(SVG.CLOSE.createIcon(14));
right.getChildren().add(btnRemove);
root.setRight(right);
@@ -35,7 +35,6 @@ import javafx.scene.Node;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.SkinBase;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
@@ -50,10 +49,7 @@ import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.SVG;
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
import org.jackhuang.hmcl.ui.animation.TransitionPane;
import org.jackhuang.hmcl.ui.construct.ComponentList;
import org.jackhuang.hmcl.ui.construct.MDListCell;
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
import org.jackhuang.hmcl.ui.construct.*;
import org.jackhuang.hmcl.util.io.CompressingUtils;
import org.jetbrains.annotations.Nullable;
@@ -274,20 +270,20 @@ final class DatapackListPageSkin extends SkinBase<DatapackListPage> {
}
}
public void loadIcon(ImageView imageView, @Nullable WeakReference<ObjectProperty<DatapackInfoObject>> current) {
public void loadIcon(ImageContainer imageContainer, @Nullable WeakReference<ObjectProperty<DatapackInfoObject>> current) {
SoftReference<CompletableFuture<Image>> iconCache = this.iconCache;
CompletableFuture<Image> imageFuture;
if (iconCache != null && (imageFuture = iconCache.get()) != null) {
Image image = imageFuture.getNow(null);
if (image != null) {
imageView.setImage(image);
imageContainer.setImage(image);
return;
}
} else {
imageFuture = CompletableFuture.supplyAsync(this::loadIcon, Schedulers.io());
this.iconCache = new SoftReference<>(imageFuture);
}
imageView.setImage(FXUtils.newBuiltinImage("/assets/img/unknown_pack.png"));
imageContainer.setImage(FXUtils.newBuiltinImage("/assets/img/unknown_pack.png"));
imageFuture.thenAcceptAsync(image -> {
if (current != null) {
ObjectProperty<DatapackInfoObject> infoObjectProperty = current.get();
@@ -296,7 +292,7 @@ final class DatapackListPageSkin extends SkinBase<DatapackListPage> {
return;
}
}
imageView.setImage(image);
imageContainer.setImage(image);
}, Schedulers.javafx());
}
@@ -304,7 +300,7 @@ final class DatapackListPageSkin extends SkinBase<DatapackListPage> {
private final class DatapackInfoListCell extends MDListCell<DatapackInfoObject> {
final JFXCheckBox checkBox = new JFXCheckBox();
ImageView imageView = new ImageView();
ImageContainer imageContainer = new ImageContainer(32);
final TwoLineListItem content = new TwoLineListItem();
BooleanProperty booleanProperty;
@@ -320,13 +316,10 @@ final class DatapackListPageSkin extends SkinBase<DatapackListPage> {
checkBox.disableProperty().bind(isReadOnlyProperty);
imageView.setFitWidth(32);
imageView.setFitHeight(32);
imageView.setPreserveRatio(true);
imageView.setImage(FXUtils.newBuiltinImage("/assets/img/unknown_pack.png"));
imageContainer.setImage(FXUtils.newBuiltinImage("/assets/img/unknown_pack.png"));
StackPane.setMargin(container, new Insets(8));
container.getChildren().setAll(checkBox, imageView, content);
container.getChildren().setAll(checkBox, imageContainer, content);
getContainer().getChildren().setAll(container);
getContainer().getParent().addEventHandler(MouseEvent.MOUSE_PRESSED, mouseEvent -> handleSelect(this, mouseEvent));
@@ -341,7 +334,7 @@ final class DatapackListPageSkin extends SkinBase<DatapackListPage> {
checkBox.selectedProperty().unbindBidirectional(booleanProperty);
}
checkBox.selectedProperty().bindBidirectional(booleanProperty = dataItem.activeProperty);
dataItem.loadIcon(imageView, new WeakReference<>(this.itemProperty()));
dataItem.loadIcon(imageContainer, new WeakReference<>(this.itemProperty()));
}
}
@@ -34,7 +34,6 @@ import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.*;
@@ -50,10 +49,7 @@ import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.WeakListenerHolder;
import org.jackhuang.hmcl.ui.construct.NoneMultipleSelectionModel;
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
import org.jackhuang.hmcl.ui.construct.*;
import org.jackhuang.hmcl.ui.decorator.DecoratorPage;
import org.jackhuang.hmcl.util.*;
import org.jackhuang.hmcl.util.i18n.I18n;
@@ -537,7 +533,7 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
private final StackPane wrapper = new StackPane();
private final TwoLineListItem content = new TwoLineListItem();
private final ImageView imageView = new ImageView();
private final ImageContainer imageContainer = new ImageContainer(40);
{
setPadding(PADDING);
@@ -547,11 +543,9 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
container.setCursor(Cursor.HAND);
container.setAlignment(Pos.CENTER_LEFT);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
imageView.setMouseTransparent(true);
imageContainer.setMouseTransparent(true);
container.getChildren().setAll(FXUtils.limitingSize(imageView, 40, 40), content);
container.getChildren().setAll(imageContainer, content);
HBox.setHgrow(content, Priority.ALWAYS);
this.graphic = new RipplerContainer(container);
@@ -584,7 +578,7 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
if (getSkinnable().shouldDisplayCategory(category))
content.addTag(getSkinnable().getLocalizedCategory(category));
}
iconLoader.load(imageView.imageProperty(), item.getIconUrl());
iconLoader.load(imageContainer.imageProperty(), item.getIconUrl());
setGraphic(wrapper);
}
}
@@ -32,8 +32,6 @@ import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Skin;
import javafx.scene.control.SkinBase;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
@@ -225,25 +223,18 @@ public class DownloadPage extends Control implements DecoratorPage {
VBox pane = new VBox(8);
pane.getStyleClass().add("gray-background");
pane.setPadding(new Insets(10));
ScrollPane scrollPane = new ScrollPane(pane);
FXUtils.smoothScrolling(scrollPane);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
HBox descriptionPane = new HBox(8);
descriptionPane.setMinHeight(Region.USE_PREF_SIZE);
descriptionPane.setAlignment(Pos.CENTER);
pane.getChildren().add(descriptionPane);
descriptionPane.getStyleClass().add("card-non-transparent");
BorderPane.setMargin(descriptionPane, new Insets(11, 11, 0, 11));
{
ImageView imageView = new ImageView();
imageView.setFitWidth(40);
imageView.setFitHeight(40);
var imageContainer = new ImageContainer(40);
if (StringUtils.isNotBlank(getSkinnable().addon.getIconUrl())) {
imageView.imageProperty().bind(FXUtils.newRemoteImage(getSkinnable().addon.getIconUrl(), 80, 80, true, true));
imageContainer.imageProperty().bind(FXUtils.newRemoteImage(getSkinnable().addon.getIconUrl(), 80, 80, true, true));
}
descriptionPane.getChildren().add(FXUtils.limitingSize(imageView, 40, 40));
descriptionPane.getChildren().add(imageContainer);
TwoLineListItem content = new TwoLineListItem();
HBox.setHgrow(content, Priority.ALWAYS);
@@ -261,14 +252,12 @@ public class DownloadPage extends Control implements DecoratorPage {
openMcmodButton.setExternalLink(getSkinnable().translations.getMcmodUrl(getSkinnable().mod));
descriptionPane.getChildren().add(openMcmodButton);
openMcmodButton.setMinWidth(Region.USE_PREF_SIZE);
FXUtils.installFastTooltip(openMcmodButton, i18n("mods.mcmod"));
}
JFXHyperlink openUrlButton = new JFXHyperlink(control.page.getLocalizedOfficialPage());
openUrlButton.setExternalLink(getSkinnable().addon.getPageUrl());
descriptionPane.getChildren().add(openUrlButton);
openUrlButton.setMinWidth(Region.USE_PREF_SIZE);
FXUtils.installFastTooltip(openUrlButton, control.page.getLocalizedOfficialPage());
}
SpinnerPane spinnerPane = new SpinnerPane();
@@ -286,8 +275,13 @@ public class DownloadPage extends Control implements DecoratorPage {
spinnerPane.setOnFailedAction(e -> getSkinnable().loadModVersions());
ComponentList list = new ComponentList();
StackPane.setAlignment(list, Pos.TOP_CENTER);
spinnerPane.setContent(list);
ScrollPane scrollPane = new ScrollPane(list);
FXUtils.smoothScrolling(scrollPane);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
FXUtils.setOverflowHidden(scrollPane, 8);
StackPane.setAlignment(scrollPane, Pos.TOP_CENTER);
spinnerPane.setContent(scrollPane);
FXUtils.onChangeAndOperate(control.loaded, loaded -> {
if (control.versions == null) return;
@@ -341,7 +335,7 @@ public class DownloadPage extends Control implements DecoratorPage {
});
}
getChildren().setAll(scrollPane);
getChildren().setAll(pane);
}
}
@@ -362,10 +356,8 @@ public class DownloadPage extends Control implements DecoratorPage {
pane.setAlignment(Pos.CENTER_LEFT);
TwoLineListItem content = new TwoLineListItem();
HBox.setHgrow(content, Priority.ALWAYS);
ImageView imageView = new ImageView();
imageView.setFitWidth(40);
imageView.setFitHeight(40);
pane.getChildren().setAll(FXUtils.limitingSize(imageView, 40, 40), content);
var imageView = new ImageContainer(40);
pane.getChildren().setAll(imageView, content);
RipplerContainer container = new RipplerContainer(pane);
FXUtils.onClicked(container, () -> {
@@ -493,6 +485,7 @@ public class DownloadPage extends Control implements DecoratorPage {
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
FXUtils.smoothScrolling(scrollPane);
FXUtils.setOverflowHidden(scrollPane, 8);
spinnerPane.setContent(scrollPane);
box.getChildren().add(spinnerPane);
VBox.setVgrow(spinnerPane, Priority.SOMETIMES);
@@ -18,8 +18,6 @@
package org.jackhuang.hmcl.ui.versions;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.image.ImageView;
import org.jackhuang.hmcl.event.Event;
import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.setting.Profiles;
@@ -27,32 +25,26 @@ import org.jackhuang.hmcl.setting.VersionIconType;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.WeakListenerHolder;
import org.jackhuang.hmcl.ui.construct.AdvancedListItem;
import org.jackhuang.hmcl.ui.construct.ImageContainer;
import java.util.function.Consumer;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
public class GameAdvancedListItem extends AdvancedListItem {
private final ImageView imageView;
private final ImageContainer imageContainer;
private final WeakListenerHolder holder = new WeakListenerHolder();
private Profile profile;
@SuppressWarnings("unused")
private Consumer<Event> onVersionIconChangedListener;
@SuppressWarnings("SuspiciousNameCombination")
public GameAdvancedListItem() {
this.imageView = new ImageView();
FXUtils.limitSize(imageView, LEFT_GRAPHIC_SIZE, LEFT_GRAPHIC_SIZE);
imageView.setPreserveRatio(true);
imageView.setImage(null);
Node imageViewWrapper = FXUtils.limitingSize(imageView, LEFT_GRAPHIC_SIZE, LEFT_GRAPHIC_SIZE);
imageView.setMouseTransparent(true);
AdvancedListItem.setAlignment(imageViewWrapper, Pos.CENTER);
setLeftGraphic(imageViewWrapper);
this.imageContainer = new ImageContainer(LEFT_GRAPHIC_SIZE);
imageContainer.setMouseTransparent(true);
AdvancedListItem.setAlignment(imageContainer, Pos.CENTER);
setLeftGraphic(imageContainer);
holder.add(FXUtils.onWeakChangeAndOperate(Profiles.selectedVersionProperty(), this::loadVersion));
}
private void loadVersion(String version) {
@@ -68,11 +60,11 @@ public class GameAdvancedListItem extends AdvancedListItem {
Profiles.getSelectedProfile().getRepository().hasVersion(version)) {
setTitle(i18n("version.manage.manage"));
setSubtitle(version);
imageView.setImage(Profiles.getSelectedProfile().getRepository().getVersionIconImage(version));
imageContainer.setImage(Profiles.getSelectedProfile().getRepository().getVersionIconImage(version));
} else {
setTitle(i18n("version.empty"));
setSubtitle(i18n("version.empty.add"));
imageView.setImage(VersionIconType.DEFAULT.getIcon());
imageContainer.setImage(VersionIconType.DEFAULT.getIcon());
}
}
}
@@ -25,7 +25,6 @@ import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.control.ListCell;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseButton;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
@@ -42,7 +41,7 @@ public final class GameListCell extends ListCell<GameListItem> {
private final Region graphic;
private final ImageView imageView;
private final ImageContainer imageView;
private final TwoLineListItem content;
private final JFXRadioButton chkSelected;
@@ -87,8 +86,7 @@ public final class GameListCell extends ListCell<GameListItem> {
center.setSpacing(8);
center.setAlignment(Pos.CENTER_LEFT);
this.imageView = new ImageView();
FXUtils.limitSize(imageView, 32, 32);
this.imageView = new ImageContainer(32);
this.content = new TwoLineListItem();
BorderPane.setAlignment(content, Pos.CENTER);
@@ -108,30 +106,26 @@ public final class GameListCell extends ListCell<GameListItem> {
right.setAlignment(Pos.CENTER_RIGHT);
this.btnUpgrade = new JFXButton();
this.btnUpgrade = FXUtils.newToggleButton4(SVG.UPDATE);
btnUpgrade.setOnAction(e -> {
GameListItem item = this.getItem();
if (item != null)
item.update();
});
btnUpgrade.getStyleClass().add("toggle-icon4");
btnUpgrade.setGraphic(SVG.UPDATE.createIcon());
FXUtils.installFastTooltip(btnUpgrade, i18n("version.update"));
right.getChildren().add(btnUpgrade);
this.btnLaunch = new JFXButton();
this.btnLaunch = FXUtils.newToggleButton4(SVG.ROCKET_LAUNCH);
btnLaunch.setOnAction(e -> {
GameListItem item = this.getItem();
if (item != null)
item.testGame();
});
btnLaunch.getStyleClass().add("toggle-icon4");
BorderPane.setAlignment(btnLaunch, Pos.CENTER);
btnLaunch.setGraphic(SVG.ROCKET_LAUNCH.createIcon());
FXUtils.installFastTooltip(btnLaunch, i18n("version.launch.test"));
right.getChildren().add(btnLaunch);
this.btnManage = new JFXButton();
this.btnManage = FXUtils.newToggleButton4(SVG.MORE_VERT);
btnManage.setOnAction(e -> {
GameListItem item = this.getItem();
if (item == null)
@@ -141,9 +135,7 @@ public final class GameListCell extends ListCell<GameListItem> {
JFXPopup.PopupVPosition vPosition = determineOptimalPopupPosition(root, popup);
popup.show(root, vPosition, JFXPopup.PopupHPosition.RIGHT, 0, vPosition == JFXPopup.PopupVPosition.TOP ? root.getHeight() : -root.getHeight());
});
btnManage.getStyleClass().add("toggle-icon4");
BorderPane.setAlignment(btnManage, Pos.CENTER);
btnManage.setGraphic(SVG.MORE_VERT.createIcon());
FXUtils.installFastTooltip(btnManage, i18n("settings.game.management"));
right.getChildren().add(btnManage);
}
@@ -30,7 +30,6 @@ import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
@@ -38,6 +37,7 @@ import javafx.scene.layout.StackPane;
import org.jackhuang.hmcl.game.Version;
import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.construct.ImageContainer;
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
import org.jackhuang.hmcl.util.StringUtils;
@@ -87,7 +87,7 @@ public final class GameListPopupMenu extends StackPane {
private final Region graphic;
private final ImageView imageView;
private final ImageContainer imageView;
private final TwoLineListItem content;
private final StringProperty tag = new SimpleStringProperty();
@@ -103,8 +103,7 @@ public final class GameListPopupMenu extends StackPane {
FXUtils.setLimitWidth(imageViewContainer, 32);
FXUtils.setLimitHeight(imageViewContainer, 32);
this.imageView = new ImageView();
FXUtils.limitSize(imageView, 32, 32);
this.imageView = new ImageContainer(32);
imageViewContainer.getChildren().setAll(imageView);
this.content = new TwoLineListItem();
@@ -43,6 +43,7 @@ import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.locks.ReentrantLock;
@@ -244,6 +245,7 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
return null;
})
.whenComplete(Schedulers.javafx(), (result, exception) -> {
if (exception instanceof CancellationException) return;
if (exception != null || result == null) {
Controllers.dialog(i18n("mods.check_updates.failed_check"), i18n("message.failed"), MessageDialogPane.MessageType.ERROR);
} else if (result.isEmpty()) {
@@ -30,7 +30,6 @@ import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.HBox;
@@ -377,20 +376,20 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
return VersionIconType.getIconType(this.localModFile.getModLoaderType()).getIcon();
}
public void loadIcon(ImageView imageView, @Nullable WeakReference<ObjectProperty<ModInfoObject>> current) {
public void loadIcon(ImageContainer imageContainer, @Nullable WeakReference<ObjectProperty<ModInfoObject>> current) {
SoftReference<CompletableFuture<Image>> iconCache = this.iconCache;
CompletableFuture<Image> imageFuture;
if (iconCache != null && (imageFuture = iconCache.get()) != null) {
Image image = imageFuture.getNow(null);
if (image != null) {
imageView.setImage(image);
imageContainer.setImage(image);
return;
}
} else {
imageFuture = CompletableFuture.supplyAsync(this::loadIcon, Schedulers.io());
this.iconCache = new SoftReference<>(imageFuture);
}
imageView.setImage(VersionIconType.getIconType(localModFile.getModLoaderType()).getIcon());
imageContainer.setImage(VersionIconType.getIconType(localModFile.getModLoaderType()).getIcon());
imageFuture.thenAcceptAsync(image -> {
if (current != null) {
ObjectProperty<ModInfoObject> infoObjectProperty = current.get();
@@ -400,7 +399,7 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
}
}
imageView.setImage(image);
imageContainer.setImage(image);
}, Schedulers.javafx());
}
}
@@ -414,9 +413,8 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
Stage stage = Controllers.getStage();
maxWidthProperty().bind(stage.widthProperty().multiply(0.7));
ImageView imageView = new ImageView();
FXUtils.limitSize(imageView, 40, 40);
modInfo.loadIcon(imageView, null);
var imageContainer = new ImageContainer(40);
modInfo.loadIcon(imageContainer, null);
TwoLineListItem title = new TwoLineListItem();
if (modInfo.getModTranslations() != null && I18n.isUseChinese())
@@ -437,7 +435,7 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
}
title.setSubtitle(subtitle.toString());
titleContainer.getChildren().setAll(FXUtils.limitingSize(imageView, 40, 40), title);
titleContainer.getChildren().setAll(imageContainer, title);
setHeading(titleContainer);
Label description = new Label(modInfo.getModInfo().getDescription().toString());
@@ -554,11 +552,11 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
private static final PseudoClass WARNING = PseudoClass.getPseudoClass("warning");
JFXCheckBox checkBox = new JFXCheckBox();
ImageView imageView = new ImageView();
ImageContainer imageContainer = new ImageContainer(24);
TwoLineListItem content = new TwoLineListItem();
JFXButton restoreButton = new JFXButton();
JFXButton infoButton = new JFXButton();
JFXButton revealButton = new JFXButton();
JFXButton restoreButton = FXUtils.newToggleButton4(SVG.RESTORE);
JFXButton infoButton = FXUtils.newToggleButton4(SVG.INFO);
JFXButton revealButton = FXUtils.newToggleButton4(SVG.FOLDER);
BooleanProperty booleanProperty;
Tooltip warningTooltip;
@@ -575,23 +573,11 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
content.setMouseTransparent(true);
setSelectable();
imageView.setFitWidth(24);
imageView.setFitHeight(24);
imageView.setPreserveRatio(true);
imageView.setImage(VersionIconType.COMMAND.getIcon());
restoreButton.getStyleClass().add("toggle-icon4");
restoreButton.setGraphic(SVG.RESTORE.createIcon());
imageContainer.setImage(VersionIconType.COMMAND.getIcon());
FXUtils.installFastTooltip(restoreButton, i18n("mods.restore"));
revealButton.getStyleClass().add("toggle-icon4");
revealButton.setGraphic(SVG.FOLDER.createIcon());
infoButton.getStyleClass().add("toggle-icon4");
infoButton.setGraphic(SVG.INFO.createIcon());
container.getChildren().setAll(checkBox, imageView, content, restoreButton, revealButton, infoButton);
container.getChildren().setAll(checkBox, imageContainer, content, restoreButton, revealButton, infoButton);
StackPane.setMargin(container, new Insets(8));
getContainer().getChildren().setAll(container);
@@ -616,7 +602,7 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
ModLoaderType modLoaderType = modInfo.getModLoaderType();
dataItem.loadIcon(imageView, new WeakReference<>(this.itemProperty()));
dataItem.loadIcon(imageContainer, new WeakReference<>(this.itemProperty()));
String displayName = modInfo.getName();
if (modTranslations != null && I18n.isUseChinese()) {
@@ -8,7 +8,6 @@ import javafx.scene.Node;
import javafx.scene.control.ListCell;
import javafx.scene.control.Skin;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
@@ -19,10 +18,7 @@ import org.jackhuang.hmcl.setting.Profile;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.ui.*;
import org.jackhuang.hmcl.ui.construct.MDListCell;
import org.jackhuang.hmcl.ui.construct.MessageDialogPane;
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
import org.jackhuang.hmcl.ui.construct.*;
import org.jackhuang.hmcl.util.io.FileUtils;
import java.io.ByteArrayInputStream;
@@ -181,10 +177,10 @@ public final class ResourcepackListPage extends ListPageBase<ResourcepackListPag
}
private static final class ResourcepackListCell extends MDListCell<ResourcepackInfoObject> {
private final ImageView imageView = new ImageView();
private final ImageContainer imageView = new ImageContainer(32);
private final TwoLineListItem content = new TwoLineListItem();
private final JFXButton btnReveal = new JFXButton();
private final JFXButton btnDelete = new JFXButton();
private final JFXButton btnReveal = FXUtils.newToggleButton4(SVG.FOLDER_OPEN);
private final JFXButton btnDelete = FXUtils.newToggleButton4(SVG.DELETE_FOREVER);
private final ResourcepackListPage page;
public ResourcepackListCell(JFXListView<ResourcepackInfoObject> listView, ResourcepackListPage page) {
@@ -198,7 +194,6 @@ public final class ResourcepackListPage extends ListPageBase<ResourcepackListPag
HBox left = new HBox(8);
left.setAlignment(Pos.CENTER);
FXUtils.limitSize(imageView, 32, 32);
left.getChildren().add(imageView);
left.setPadding(new Insets(0, 8, 0, 0));
FXUtils.setLimitWidth(left, 48);
@@ -207,12 +202,6 @@ public final class ResourcepackListPage extends ListPageBase<ResourcepackListPag
HBox.setHgrow(content, Priority.ALWAYS);
root.setCenter(content);
btnReveal.getStyleClass().add("toggle-icon4");
btnReveal.setGraphic(SVG.FOLDER_OPEN.createIcon());
btnDelete.getStyleClass().add("toggle-icon4");
btnDelete.setGraphic(SVG.DELETE_FOREVER.createIcon());
HBox right = new HBox(8);
right.setAlignment(Pos.CENTER_RIGHT);
right.getChildren().setAll(btnReveal, btnDelete);
@@ -25,7 +25,6 @@ import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.BorderPane;
@@ -442,9 +441,7 @@ public final class SchematicsPage extends ListPageBase<SchematicsPage.Item> impl
if (image == null) {
return super.getIcon(size);
} else {
ImageView imageView = new ImageView();
imageView.setFitHeight(size);
imageView.setFitWidth(size);
var imageView = new ImageContainer(size);
imageView.setImage(image);
return imageView;
}
@@ -548,7 +545,7 @@ public final class SchematicsPage extends ListPageBase<SchematicsPage.Item> impl
private final TwoLineListItem center;
private final HBox right;
private final ImageView iconImageView;
private final ImageContainer iconImageView;
private final SVGContainer iconSVGView;
private final Tooltip tooltip = new Tooltip();
@@ -562,9 +559,7 @@ public final class SchematicsPage extends ListPageBase<SchematicsPage.Item> impl
this.left = new StackPane();
left.setPadding(new Insets(0, 8, 0, 0));
this.iconImageView = new ImageView();
FXUtils.limitSize(iconImageView, 32, 32);
this.iconImageView = new ImageContainer(32);
this.iconSVGView = new SVGContainer(32);
BorderPane.setAlignment(left, Pos.CENTER);
@@ -580,19 +575,15 @@ public final class SchematicsPage extends ListPageBase<SchematicsPage.Item> impl
this.right = new HBox(8);
right.setAlignment(Pos.CENTER_RIGHT);
JFXButton btnReveal = new JFXButton();
JFXButton btnReveal = FXUtils.newToggleButton4(SVG.FOLDER_OPEN);
FXUtils.installFastTooltip(btnReveal, i18n("reveal.in_file_manager"));
btnReveal.getStyleClass().add("toggle-icon4");
btnReveal.setGraphic(SVG.FOLDER_OPEN.createIcon());
btnReveal.setOnAction(event -> {
Item item = getItem();
if (item != null && !(item instanceof BackItem))
item.onReveal();
});
JFXButton btnDelete = new JFXButton();
btnDelete.getStyleClass().add("toggle-icon4");
btnDelete.setGraphic(SVG.DELETE_FOREVER.createIcon());
JFXButton btnDelete = FXUtils.newToggleButton4(SVG.DELETE_FOREVER);
btnDelete.setOnAction(event -> {
Item item = getItem();
if (item != null && !(item instanceof BackItem)) {
@@ -21,6 +21,8 @@ import com.jfoenix.controls.JFXPopup;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.event.Event;
import javafx.event.EventType;
import javafx.scene.Node;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
@@ -61,6 +63,13 @@ public class VersionPage extends DecoratorAnimatedPage implements DecoratorPage
private String preferredVersionName = null;
public static class WorkingDirChangedEvent extends Event {
public static final EventType<WorkingDirChangedEvent> EVENT_TYPE = new EventType<>(Event.ANY, "WORKING_DIR_CHANGED");
public WorkingDirChangedEvent() {
super(EVENT_TYPE);
}
}
public VersionPage() {
versionSettingsTab.setNodeSupplier(loadVersionFor(() -> new VersionSettingsPage(false)));
installerListTab.setNodeSupplier(loadVersionFor(InstallerListPage::new));
@@ -74,6 +83,21 @@ public class VersionPage extends DecoratorAnimatedPage implements DecoratorPage
addEventHandler(Navigator.NavigationEvent.NAVIGATED, this::onNavigated);
addEventHandler(WorkingDirChangedEvent.EVENT_TYPE, event -> {
if (this.version.get() != null) {
if (installerListTab.isInitialized())
installerListTab.getNode().loadVersion(getProfile(), getVersion());
if (modListTab.isInitialized())
modListTab.getNode().loadVersion(getProfile(), getVersion());
if (resourcePackTab.isInitialized())
resourcePackTab.getNode().loadVersion(getProfile(), getVersion());
if (worldListTab.isInitialized())
worldListTab.getNode().loadVersion(getProfile(), getVersion());
if (schematicsTab.isInitialized())
schematicsTab.getNode().loadVersion(getProfile(), getVersion());
}
});
listenerHolder.add(EventBus.EVENT_BUS.channel(RefreshedVersionsEvent.class).registerWeak(event -> checkSelectedVersion(), EventPriority.HIGHEST));
}
@@ -34,8 +34,12 @@ import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.FileChooser;
import javafx.stage.Screen;
import org.jackhuang.hmcl.game.*;
import org.jackhuang.hmcl.game.GameDirectoryType;
import org.jackhuang.hmcl.game.HMCLGameRepository;
import org.jackhuang.hmcl.game.ProcessPriority;
import org.jackhuang.hmcl.game.Version;
import org.jackhuang.hmcl.java.JavaManager;
import org.jackhuang.hmcl.java.JavaRuntime;
import org.jackhuang.hmcl.setting.*;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.FXUtils;
@@ -48,7 +52,6 @@ import org.jackhuang.hmcl.util.javafx.BindingMapping;
import org.jackhuang.hmcl.util.javafx.PropertyUtils;
import org.jackhuang.hmcl.util.javafx.SafeStringConverter;
import org.jackhuang.hmcl.util.platform.Architecture;
import org.jackhuang.hmcl.java.JavaRuntime;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
import org.jackhuang.hmcl.util.platform.SystemInfo;
import org.jackhuang.hmcl.util.platform.hardware.PhysicalMemoryStatus;
@@ -99,6 +102,10 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
private final InvalidationListener usesGlobalListener;
private final ChangeListener<Boolean> specificSettingsListener;
private final InvalidationListener javaListener = any -> initJavaSubtitle();
private final ChangeListener<GameDirectoryType> gameDirTypeListener = (ob, o, n) -> fireWorkingDirChanged();
private final ChangeListener<String> gameDirListener = (ob, o, n) -> fireWorkingDirChanged();
private boolean updatingJavaSetting = false;
private boolean updatingSelectedJava = false;
@@ -455,13 +462,20 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
else
profile.getRepository().globalizeVersionSetting(versionId);
Platform.runLater(() -> loadVersion(profile, versionId));
FXUtils.runInFX(() -> {
loadVersion(profile, versionId);
fireWorkingDirChanged();
});
};
addEventHandler(Navigator.NavigationEvent.NAVIGATED, this::onDecoratorPageNavigating);
componentList.disableProperty().bind(enableSpecificSettings.not());
}
private void fireWorkingDirChanged() {
FXUtils.runInFX(() -> fireEvent(new VersionPage.WorkingDirChangedEvent()));
}
@Override
public void loadVersion(Profile profile, String versionId) {
@@ -513,6 +527,9 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
lastVersionSetting.defaultJavaPathPropertyProperty().removeListener(javaListener);
lastVersionSetting.javaVersionProperty().removeListener(javaListener);
lastVersionSetting.gameDirTypeProperty().removeListener(gameDirTypeListener);
lastVersionSetting.gameDirProperty().removeListener(gameDirListener);
gameDirItem.selectedDataProperty().unbindBidirectional(lastVersionSetting.gameDirTypeProperty());
gameDirSublist.subtitleProperty().unbind();
@@ -589,6 +606,9 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
gameDirSublist.subtitleProperty().bind(Bindings.createStringBinding(() -> profile.getRepository().getRunDirectory(versionId).toAbsolutePath().normalize().toString(),
versionSetting.gameDirProperty(), versionSetting.gameDirTypeProperty()));
versionSetting.gameDirTypeProperty().addListener(gameDirTypeListener);
versionSetting.gameDirProperty().addListener(gameDirListener);
lastVersionSetting = versionSetting;
initJavaSubtitle();
@@ -727,7 +747,6 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
}
iconPickerItem.setImage(profile.getRepository().getVersionIconImage(versionId));
FXUtils.limitSize(iconPickerItem.getImageView(), 32, 32);
}
private static List<String> getSupportedResolutions() {
@@ -26,7 +26,6 @@ import javafx.scene.Node;
import javafx.scene.control.Control;
import javafx.scene.control.Skin;
import javafx.scene.control.SkinBase;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
@@ -35,6 +34,7 @@ import org.jackhuang.hmcl.game.WorldLockedException;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.ui.*;
import org.jackhuang.hmcl.ui.construct.ImageContainer;
import org.jackhuang.hmcl.ui.construct.MessageDialogPane;
import org.jackhuang.hmcl.ui.construct.RipplerContainer;
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
@@ -232,9 +232,8 @@ public final class WorldBackupsPage extends ListPageBase<WorldBackupsPage.Backup
root.setLeft(left);
left.setPadding(new Insets(0, 8, 0, 0));
ImageView imageView = new ImageView();
var imageView = new ImageContainer(32);
left.getChildren().add(imageView);
FXUtils.limitSize(imageView, 32, 32);
imageView.setImage(world.getIcon() == null ? FXUtils.newBuiltinImage("/assets/img/unknown_server.png") : world.getIcon());
}
@@ -255,18 +254,14 @@ public final class WorldBackupsPage extends ListPageBase<WorldBackupsPage.Backup
root.setRight(right);
right.setAlignment(Pos.CENTER_RIGHT);
JFXButton btnReveal = new JFXButton();
JFXButton btnReveal = FXUtils.newToggleButton4(SVG.FOLDER_OPEN);
right.getChildren().add(btnReveal);
FXUtils.installFastTooltip(btnReveal, i18n("reveal.in_file_manager"));
btnReveal.getStyleClass().add("toggle-icon4");
btnReveal.setGraphic(SVG.FOLDER_OPEN.createIcon());
btnReveal.setOnAction(event -> skinnable.onReveal());
JFXButton btnDelete = new JFXButton();
JFXButton btnDelete = FXUtils.newToggleButton4(SVG.DELETE);
right.getChildren().add(btnDelete);
FXUtils.installFastTooltip(btnDelete, i18n("world.backup.delete"));
btnDelete.getStyleClass().add("toggle-icon4");
btnDelete.setGraphic(SVG.DELETE.createIcon());
btnDelete.setOnAction(event -> Controllers.confirm(i18n("button.remove.confirm"), i18n("button.remove"), skinnable::onDelete, null));
}
@@ -30,14 +30,11 @@ import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.effect.BoxBlur;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
import org.jackhuang.hmcl.game.World;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
import org.jackhuang.hmcl.ui.Controllers;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.SVG;
@@ -67,9 +64,10 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
private final WorldManagePage worldManagePage;
private boolean isReadOnly;
private final World world;
private CompoundTag levelDat;
private CompoundTag levelData;
private CompoundTag playerData;
ImageView iconImageView = new ImageView();
private final ImageContainer iconImageView = new ImageContainer(32);
public WorldInfoPage(WorldManagePage worldManagePage) {
this.worldManagePage = worldManagePage;
@@ -77,15 +75,9 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
refresh();
}
private CompoundTag loadWorldInfo() throws IOException {
if (!Files.isDirectory(world.getFile()))
throw new IOException("Not a valid world directory");
return world.getLevelData();
}
private void updateControls() {
CompoundTag dataTag = levelDat.get("Data");
CompoundTag dataTag = levelData.get("Data");
CompoundTag playerTag = playerData;
ScrollPane scrollPane = new ScrollPane();
scrollPane.setFitToHeight(true);
@@ -137,14 +129,12 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
iconPane.setTitle(i18n("world.icon"));
{
FXUtils.limitSize(iconImageView, 32, 32);
iconImageView.setImage(world.getIcon() == null ? FXUtils.newBuiltinImage("/assets/img/unknown_server.png") : world.getIcon());
}
JFXButton editIconButton = new JFXButton();
JFXButton resetIconButton = new JFXButton();
JFXButton editIconButton = FXUtils.newToggleButton4(SVG.EDIT, 20);
JFXButton resetIconButton = FXUtils.newToggleButton4(SVG.RESTORE, 20);
{
editIconButton.setGraphic(SVG.EDIT.createIcon(20));
editIconButton.setDisable(isReadOnly);
editIconButton.setOnAction(event -> Controllers.confirm(
I18n.i18n("world.icon.change.tip"),
@@ -154,13 +144,10 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
null
));
FXUtils.installFastTooltip(editIconButton, i18n("button.edit"));
editIconButton.getStyleClass().add("toggle-icon4");
resetIconButton.setGraphic(SVG.RESTORE.createIcon(20));
resetIconButton.setDisable(isReadOnly);
resetIconButton.setOnAction(event -> this.clearWorldIcon());
FXUtils.installFastTooltip(resetIconButton, i18n("button.reset"));
resetIconButton.getStyleClass().add("toggle-icon4");
}
HBox hBox = new HBox(8);
@@ -211,12 +198,14 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
worldSpawnPoint.setTitle(i18n("world.info.spawn"));
String value;
// Valid after 1.21.9-pre1
if (dataTag.get("spawn") instanceof CompoundTag spawnTag && spawnTag.get("pos") instanceof IntArrayTag posTag) {
value = Dimension.of(spawnTag.get("dimension") instanceof StringTag dimensionTag
? dimensionTag
: new StringTag("SpawnDimension", "minecraft:overworld"))
.formatPosition(posTag);
} else if (dataTag.get("SpawnX") instanceof IntTag intX
value = (spawnTag.get("dimension") instanceof StringTag dimensionTag)
? Dimension.of(dimensionTag).formatPosition(posTag)
: Dimension.OVERWORLD.formatPosition(posTag);
}
// Valid before 1.21.9-pre1
else if (dataTag.get("SpawnX") instanceof IntTag intX
&& dataTag.get("SpawnY") instanceof IntTag intY
&& dataTag.get("SpawnZ") instanceof IntTag intZ) {
value = Dimension.OVERWORLD.formatPosition(intX.getValue(), intY.getValue(), intZ.getValue());
@@ -254,34 +243,51 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
{
generateFeaturesButton.setTitle(i18n("world.info.generate_features"));
generateFeaturesButton.setDisable(isReadOnly);
// generate_features was valid after 20w20a and MapFeatures was before that
if (dataTag.get("WorldGenSettings") instanceof CompoundTag worldGenSettings) {
bindTagAndToggleButton(worldGenSettings.get("generate_features"), generateFeaturesButton);
// Valid before (1.16)20w20a
if (dataTag.get("MapFeatures") instanceof ByteTag generateFeaturesTag) {
bindTagAndToggleButton(generateFeaturesTag, generateFeaturesButton);
}
// Valid after (1.16)20w20a
else if (world.getNormalizedWorldGenSettingsData() != null) {
CompoundTag unifiedWorldGenSettingsDataTag = world.getNormalizedWorldGenSettingsData();
Tag tag = unifiedWorldGenSettingsDataTag.get("generate_features"); // Valid between (1.16)20w20a and 26.1-snapshot-6
if (tag == null)
tag = unifiedWorldGenSettingsDataTag.get("generate_structures"); // Valid after 26.1-snapshot-6
bindTagAndToggleButton(tag, generateFeaturesButton);
} else {
bindTagAndToggleButton(dataTag.get("MapFeatures"), generateFeaturesButton);
generateFeaturesButton.setDisable(true);
}
}
var difficultyButton = new LineSelectButton<Difficulty>();
{
difficultyButton.setTitle(i18n("world.info.difficulty"));
difficultyButton.setDisable(worldManagePage.isReadOnly());
difficultyButton.setDisable(isReadOnly);
difficultyButton.setItems(Difficulty.items);
if (dataTag.get("Difficulty") instanceof ByteTag difficultyTag) {
Difficulty difficulty = Difficulty.of(difficultyTag.getValue());
if (difficulty != null) {
difficultyButton.setValue(difficulty);
difficultyButton.valueProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
difficultyTag.setValue((byte) newValue.ordinal());
saveLevelDat();
}
});
} else {
difficultyButton.setDisable(true);
}
Difficulty difficulty;
// Valid before 26.1-snapshot-6
if (dataTag.get("Difficulty") instanceof ByteTag difficultyTag
&& (difficulty = Difficulty.of(difficultyTag.getValue())) != null) {
difficultyButton.setValue(difficulty);
difficultyButton.valueProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
difficultyTag.setValue((byte) newValue.ordinal());
saveWorldData();
}
});
}
// Valid after 26.1-snapshot-6
else if (dataTag.get("difficulty_settings") instanceof CompoundTag difficultySettingTag
&& difficultySettingTag.get("difficulty") instanceof StringTag difficultyTag
&& (difficulty = Difficulty.of(difficultyTag.getValue())) != null) {
difficultyButton.setValue(difficulty);
difficultyButton.valueProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
difficultyTag.setValue(newValue.getTagStringValue());
saveWorldData();
}
});
} else {
difficultyButton.setDisable(true);
}
@@ -291,8 +297,17 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
{
difficultyLockPane.setTitle(i18n("world.info.difficulty_lock"));
difficultyLockPane.setDisable(isReadOnly);
bindTagAndToggleButton(dataTag.get("DifficultyLocked"), difficultyLockPane);
// Valid before 26.1-snapshot-6
if (dataTag.get("DifficultyLocked") instanceof ByteTag difficultyLockedTag) {
bindTagAndToggleButton(difficultyLockedTag, difficultyLockPane);
}
// Valid after 26.1-snapshot-6
else if (dataTag.get("difficulty_settings") instanceof CompoundTag difficultySettingTag
&& difficultySettingTag.get("locked") instanceof ByteTag lockedTag) {
bindTagAndToggleButton(lockedTag, difficultyLockPane);
} else {
difficultyLockPane.setDisable(true);
}
}
worldInfo.getContent().setAll(
@@ -302,7 +317,7 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
rootPane.getChildren().addAll(ComponentList.createComponentListTitle(i18n("world.info")), worldInfo);
}
if (dataTag.get("Player") instanceof CompoundTag playerTag) {
if (playerTag != null) {
ComponentList playerInfo = new ComponentList();
var locationPane = new LineTextPane();
@@ -349,8 +364,14 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
playerGameTypePane.setDisable(worldManagePage.isReadOnly());
playerGameTypePane.setItems(GameType.items);
if (playerTag.get("playerGameType") instanceof IntTag playerGameTypeTag
&& dataTag.get("hardcore") instanceof ByteTag hardcoreTag) {
// Valid before 26.1-snapshot-6
Tag rawHardcoreTag = dataTag.get("hardcore");
// Valid after 26.1-snapshot-6
if (rawHardcoreTag == null && dataTag.get("difficulty_settings") instanceof CompoundTag difficultySettingsTag) {
rawHardcoreTag = difficultySettingsTag.get("hardcore");
}
if (playerTag.get("playerGameType") instanceof IntTag playerGameTypeTag && rawHardcoreTag instanceof ByteTag hardcoreTag) {
boolean isHardcore = hardcoreTag.getValue() == 1;
GameType gameType = GameType.of(playerGameTypeTag.getValue(), isHardcore);
if (gameType != null) {
@@ -364,7 +385,7 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
playerGameTypeTag.setValue(newValue.ordinal());
hardcoreTag.setValue((byte) 0);
}
saveLevelDat();
saveWorldData();
}
});
} else {
@@ -434,10 +455,10 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
toggleButton.selectedProperty().addListener((o, oldValue, newValue) -> {
try {
byteTag.setValue((byte) (newValue ? 1 : 0));
saveLevelDat();
saveWorldData();
} catch (Exception e) {
toggleButton.setSelected(oldValue);
LOG.warning("Exception happened when saving level.dat", e);
LOG.warning("Exception happened when saving world info", e);
}
});
} else {
@@ -457,11 +478,11 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
Integer integer = Lang.toIntOrNull(newValue);
if (integer != null) {
intTag.setValue(integer);
saveLevelDat();
saveWorldData();
}
} catch (Exception e) {
jfxTextField.setText(oldValue);
LOG.warning("Exception happened when saving level.dat", e);
LOG.warning("Exception happened when saving world data", e);
}
}
});
@@ -478,11 +499,11 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
Float floatValue = Lang.toFloatOrNull(newValue);
if (floatValue != null) {
floatTag.setValue(floatValue);
saveLevelDat();
saveWorldData();
}
} catch (Exception e) {
jfxTextField.setText(oldValue);
LOG.warning("Exception happened when saving level.dat", e);
LOG.warning("Exception happened when saving world data", e);
}
}
});
@@ -490,30 +511,27 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
jfxTextField.setValidators(new DoubleValidator(i18n("input.number"), true));
}
private void saveLevelDat() {
LOG.info("Saving level.dat of world " + world.getWorldName());
private void saveWorldData() {
LOG.info("Saving data of world " + world.getWorldName());
try {
this.world.writeLevelDat(levelDat);
this.world.writeWorldData();
} catch (IOException e) {
LOG.warning("Failed to save level.dat of world " + world.getWorldName(), e);
LOG.warning("Failed to save world data", e);
}
}
@Override
public void refresh() {
this.isReadOnly = worldManagePage.isReadOnly();
this.setLoading(true);
Task.supplyAsync(this::loadWorldInfo)
.whenComplete(Schedulers.javafx(), ((result, exception) -> {
if (exception == null) {
this.levelDat = result;
updateControls();
setLoading(false);
} else {
LOG.warning("Failed to load level.dat", exception);
setFailedReason(i18n("world.info.failed"));
}
})).start();
setFailedReason(null);
try {
this.isReadOnly = worldManagePage.isReadOnly();
this.levelData = world.getLevelData();
this.playerData = world.getPlayerData();
updateControls();
} catch (Exception e) {
LOG.warning("Failed to refresh world info", e);
setFailedReason(i18n("world.info.failed"));
}
}
private record Dimension(String name) {
@@ -594,6 +612,15 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
return (d >= 0 && d < items.size()) ? items.get(d) : null;
}
static Difficulty of(String name) {
for (Difficulty d : items) if (d.name().toLowerCase(Locale.ROOT).equals(name)) return d;
return null;
}
String getTagStringValue() {
return this.name().toLowerCase(Locale.ROOT);
}
@Override
public String toString() {
return i18n("world.info.difficulty." + name().toLowerCase(Locale.ROOT));
@@ -659,7 +686,7 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
Files.deleteIfExists(output);
iconImageView.setImage(FXUtils.newBuiltinImage("/assets/img/unknown_server.png"));
} catch (IOException e) {
LOG.warning("Failed to delete world icon " + e.getMessage());
LOG.warning("Failed to delete world icon ", e);
}
}
}
@@ -30,7 +30,6 @@ import javafx.scene.Node;
import javafx.scene.control.ListCell;
import javafx.scene.control.Skin;
import javafx.scene.control.Tooltip;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseButton;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
@@ -243,7 +242,7 @@ public final class WorldListPage extends ListPageBase<World> implements VersionP
private final WorldListPage page;
private final RipplerContainer graphic;
private final ImageView imageView;
private final ImageContainer imageView;
private final Tooltip leftTooltip;
private final TwoLineListItem content;
private final JFXButton btnLaunch;
@@ -262,9 +261,8 @@ public final class WorldListPage extends ListPageBase<World> implements VersionP
root.setLeft(left);
left.setPadding(new Insets(0, 8, 0, 0));
this.imageView = new ImageView();
this.imageView = new ImageContainer(32);
left.getChildren().add(imageView);
FXUtils.limitSize(imageView, 32, 32);
}
{
@@ -278,12 +276,10 @@ public final class WorldListPage extends ListPageBase<World> implements VersionP
root.setRight(right);
right.setAlignment(Pos.CENTER_RIGHT);
btnLaunch = new JFXButton();
btnLaunch = FXUtils.newToggleButton4(SVG.ROCKET_LAUNCH);
btnLaunch.visibleProperty().bind(page.supportQuickPlayProperty());
btnLaunch.managedProperty().bind(btnLaunch.visibleProperty());
right.getChildren().add(btnLaunch);
btnLaunch.getStyleClass().add("toggle-icon4");
btnLaunch.setGraphic(SVG.ROCKET_LAUNCH.createIcon());
FXUtils.installFastTooltip(btnLaunch, i18n("version.launch"));
btnLaunch.setOnAction(event -> {
World world = getItem();
@@ -291,10 +287,8 @@ public final class WorldListPage extends ListPageBase<World> implements VersionP
page.launch(world);
});
JFXButton btnMore = new JFXButton();
JFXButton btnMore = FXUtils.newToggleButton4(SVG.MORE_VERT);
right.getChildren().add(btnMore);
btnMore.getStyleClass().add("toggle-icon4");
btnMore.setGraphic(SVG.MORE_VERT.createIcon());
btnMore.setOnAction(event -> {
World world = getItem();
if (world != null)
@@ -78,9 +78,9 @@ public final class WorldManagePage extends DecoratorAnimatedPage implements Deco
updateSessionLockChannel();
try {
this.world.reloadLevelDat();
this.world.reloadWorldData();
} catch (IOException e) {
LOG.warning("Can not load world level.dat of world: " + this.world.getFile(), e);
LOG.warning("Can not load world data of world: " + this.world.getFile(), e);
this.addEventHandler(Navigator.NavigationEvent.NAVIGATED, event -> closePageForLoadingFail());
}
@@ -106,9 +106,9 @@ public final class WorldManagePage extends DecoratorAnimatedPage implements Deco
public void refresh() {
updateSessionLockChannel();
try {
world.reloadLevelDat();
world.reloadWorldData();
} catch (IOException e) {
LOG.warning("Can not load world level.dat of world: " + world.getFile(), e);
LOG.warning("Can not load world data of world: " + world.getFile(), e);
closePageForLoadingFail();
return;
}
@@ -1,35 +0,0 @@
/*
* 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.wizard;
public enum WizardNavigationResult {
PROCEED {
@Override
public boolean getDeferredComputation() {
return true;
}
},
DENY {
@Override
public boolean getDeferredComputation() {
return false;
}
};
public abstract boolean getDeferredComputation();
}
@@ -20,20 +20,12 @@ package org.jackhuang.hmcl.util;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import org.jackhuang.hmcl.Metadata;
import org.jackhuang.hmcl.countly.CrashReport;
import org.jackhuang.hmcl.ui.CrashWindow;
import org.jackhuang.hmcl.upgrade.IntegrityChecker;
import org.jackhuang.hmcl.upgrade.UpdateChecker;
import org.jackhuang.hmcl.util.io.NetworkUtils;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
import static org.jackhuang.hmcl.util.Pair.pair;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
/**
* @author huangyuhui
@@ -103,9 +95,6 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler {
if (showCrashWindow) {
new CrashWindow(report).show();
}
if (!UpdateChecker.isOutdated() && IntegrityChecker.isSelfVerified()) {
reportToServer(report);
}
}
});
} catch (Throwable handlingException) {
@@ -115,22 +104,4 @@ public final class CrashReporter implements Thread.UncaughtExceptionHandler {
FileSaver.shutdown();
LOG.shutdown();
}
private void reportToServer(CrashReport crashReport) {
Thread t = new Thread(() -> {
HashMap<String, String> map = new HashMap<>();
map.put("crash_report", crashReport.getDisplayText());
map.put("version", Metadata.VERSION);
map.put("log", LOG.getLogs());
try {
String response = NetworkUtils.doPost(URI.create(Metadata.PUBLISH_URL + "/hmcl/crash.php"), map);
if (StringUtils.isNotBlank(response))
LOG.error("Crash server response: " + response);
} catch (IOException ex) {
LOG.error("Unable to post HMCL server.", ex);
}
});
t.setDaemon(true);
t.start();
}
}
+17 -4
View File
@@ -29,8 +29,8 @@
.scroll-bar .thumb {
-fx-fill: -monet-surface-tint;
-fx-arc-width: 0;
-fx-arc-height: 0;
-fx-arc-width: 8;
-fx-arc-height: 8;
}
.title-label {
@@ -445,6 +445,7 @@
-fx-max-height: 55px;
-fx-min-height: 55px;
-fx-background-color: -monet-primary-container;
-fx-opacity: 1; /* Override the opacity of disabled button */
-fx-cursor: hand;
}
@@ -1170,7 +1171,7 @@
-fx-background-insets: 0px;
-jfx-toggle-color: -monet-primary;
-jfx-toggle-line-color: -monet-primary-container;
-jfx-toggle-line-color: -monet-secondary-container;
-jfx-untoggle-color: -monet-outline;
-jfx-untoggle-line-color: -monet-surface-container-highest;
-jfx-size: 10;
@@ -1941,6 +1942,10 @@
-fx-padding: 10 16 10 16;
}
.line-component .subtitle-label {
-fx-text-fill: -monet-on-surface-variant;
}
.line-component.no-padding .line-component-container {
-fx-padding: 0;
}
@@ -1970,12 +1975,20 @@
-fx-font-size: 13px;
}
.line-select-button .menu-container .title-label {
-fx-text-fill: -monet-on-surface;
}
.line-select-button .menu-container .subtitle-label {
-fx-text-fill: -monet-on-surface-variant;
}
.line-select-button .menu-container:selected .title-label {
-fx-text-fill: -monet-primary;
}
.line-select-button .menu-container:selected .subtitle-label {
-fx-text-fill: -monet-primary;
-fx-text-fill: -monet-primary-container;
}
.line-toggle-button .jfx-toggle-button {
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -21,7 +21,7 @@
about=About
about.copyright=Copyright
about.copyright.statement=Copyright © 2026 huangyuhui
about.copyright.statement=Copyright © 2013-2026 huangyuhui and contributors.
about.author=Author
about.author.statement=bilibili @huanghongxun
about.claim=EULA
@@ -439,7 +439,7 @@ You can continue to keep the old version of Java.\
HMCL can recognize and manage multiple Java versions and will automatically select the appropriate Java for you based on the game version.
fatal.deprecated_java_version.download_link=Download Java %d
fatal.samba=If you opened Hello Minecraft! Launcher from a Samba network drive, some features might not be working. Please try updating your Java or moving the launcher to another directory.
fatal.illegal_char=Your user path contains an illegal character "=". You will not be able to use authlib-injector or change the skin of your offline account.
fatal.illegal_char=Your working directory contains an illegal character "=". You will not be able to use authlib-injector or change the skin of your offline account.
fatal.unsupported_platform=Minecraft is not fully supported on your platform yet, so you may experience missing features or even be unable to launch the game.\n\
\n\
If you cannot launch Minecraft 1.17 and later, you can try switching the "Renderer" to "Mesa LLVMpipe" in "Global/Instance-specific Settings → Advanced Settings" to use CPU rendering for better compatibility.
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -21,7 +21,6 @@
about=Acerca de
about.copyright=Copyright
about.copyright.statement=Copyright © 2026 huangyuhui.
about.author=Autor
about.author.statement=bilibili @huanghongxun
about.claim=EULA
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -20,7 +20,6 @@
about=について
about.copyright=著作権
about.copyright.statement=Copyright © 2026 huangyuhui
about.author=著者
about.author.statement=bilibili @huanghongxun
about.claim=EULA
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -20,7 +20,6 @@
about=有涉
about.copyright=持權
about.copyright.statement=© 2026 huangyuhui 持權
about.author=作者
about.author.statement=嗶站 @huanghongxun
about.claim=客契
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -20,7 +20,6 @@
about=О лаунчере
about.copyright=Авторские права
about.copyright.statement=Авторские права © 2026 huangyuhui.
about.author=Автор
about.author.statement=bilibili @huanghongxun
about.claim=EULA
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -20,7 +20,6 @@
about=Про програму
about.copyright=Авторське право
about.copyright.statement=Авторське право © 2026 huangyuhui
about.author=Автор
about.author.statement=bilibili @huanghongxun
about.claim=Ліцензійна угода з кінцевим користувачем (EULA)
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -20,7 +20,7 @@
about=關於
about.copyright=著作權
about.copyright.statement=著作權所有 © 2026 huangyuhui
about.copyright.statement=著作權所有 © 2013-2026 huangyuhui 與貢獻者
about.author=作者
about.author.statement=bilibili @huanghongxun
about.claim=使用者協議
@@ -30,7 +30,7 @@ about.legal=法律宣告
about.thanks_to=鳴謝
about.thanks_to.bangbang93.statement=提供 BMCLAPI 下載來源。請贊助支援 BMCLAPI!
about.thanks_to.burningtnt.statement=為 HMCL 貢獻許多技術支援
about.thanks_to.contributors=所有透過 Issue、Pull Request 等管道參與本項目的貢獻者
about.thanks_to.contributors=所有透過 Issue、Pull Request 等管道參與本專案的貢獻者
about.thanks_to.contributors.statement=沒有開源社群的支援,HMCL 無法走到今天
about.thanks_to.gamerteam.statement=提供預設背景圖
about.thanks_to.glavo.statement=負責 HMCL 的日常維護
@@ -104,7 +104,7 @@ account.methods=登入方式
account.methods.authlib_injector=外部登入
account.methods.microsoft=Microsoft 帳戶
account.methods.microsoft.birth=如何變更帳戶出生日期
account.methods.microsoft.code=代碼 (已自動複製)
account.methods.microsoft.code=程式碼 (已自動複製)
account.methods.microsoft.close_page=已完成 Microsoft 帳戶授權。啟動器將自動執行後續步驟。你現在可以關閉本頁面了。
account.methods.microsoft.deauthorize=移除應用存取權
account.methods.microsoft.error.add_family=請點擊 <a href="https://support.microsoft.com/account-billing/837badbc-999e-54d2-2617-d19206b9540a">此處</a> 更改你的帳戶出生日期,使年齡滿 18 歲以上,或將帳戶加入到家庭中。
@@ -408,7 +408,7 @@ fatal.deprecated_java_version=HMCL 未來需要 Java 17 或更高版本才能執
fatal.deprecated_java_version.update=更高版本的 HMCL 需要 Java 17 或更高版本才能執行,請安裝最新版本的 Java 以確保 HMCL 能夠完成升級。\n你可以繼續保留舊版本 Java。HMCL 能夠識別與管理多個 Java,並會自動根據遊戲版本為你選取合適的 Java。
fatal.deprecated_java_version.download_link=下載 Java %d
fatal.samba=如果您正在透過 Samba 共亯的目錄中開啟 Hello Minecraft! Launcher,啟動器可能無法正常工作,請嘗試更新您的 Java 或在本機目錄內開啟 HMCL。
fatal.illegal_char=由於您的使用者目錄路徑中存在無效字元『=』,您將無法使用外部登入帳戶以及離線登入更換外觀功能。
fatal.illegal_char=由於您的執行路徑中存在無效字元『=』,您將無法使用外部登入帳戶以及離線登入更換外觀功能。
fatal.unsupported_platform=Minecraft 尚未對您的平臺提供完善支援,所以可能影響遊戲體驗或無法啟動遊戲。\n\
若無法啟動 Minecraft 1.17 及更高版本,可以嘗試在「(全域/實例特定) 遊戲設定 → 進階設定 → 除錯選項」中將「繪製器」切換為「Mesa LLVMpipe」,以獲得更好的相容性。
fatal.unsupported_platform.loongarch=Hello Minecraft! Launcher 已為龍芯提供支援。\n如果遇到問題,你可以點擊右上角幫助按鈕進行求助。
@@ -479,7 +479,7 @@ game.crash.reason.mod_resolution_mod_version.any=%1$s (任意版本)
game.crash.reason.forge_repeat_installation=目前遊戲由於 Forge 重複安裝,無法繼續執行。<a href="https://github.com/HMCL-dev/HMCL/issues/1880">此為已知問題</a>\n建議將日誌上傳並回報至 GitHub,以便我們找到更多線索並修復此問題。\n目前你可以在「實例管理 → 自動安裝」中移除 Forge 並重新安裝。
game.crash.reason.optifine_repeat_installation=目前遊戲由於重複安裝 OptiFine,無法繼續執行。\n請刪除模組目錄下的 OptiFine 或前往「實例管理 → 自動安裝」移除安裝的 OptiFine。
game.crash.reason.optifine_is_not_compatible_with_forge=目前遊戲由於 OptiFine 與目前版本的 Forge 不相容,導致了遊戲崩潰。\n請前往 <a href="https://optifine.net/downloads">OptiFine 官網</a>查看 OptiFine 所相容的 Forge 版本,並嚴格按照對應版本重新安裝遊戲,或在「實例管理 → 自動安裝」中更換版本。\n經測試,Forge 版本過高或過低都可能導致崩潰。
game.crash.reason.night_config_fixes=目前遊戲由於 Night Config 庫的一些問題,無法繼續執行。\n你可以嘗試安裝 <a href="https://www.curseforge.com/minecraft/mc-mods/night-config-fixes">Night Config Fixes</a> 模組,這或許能幫助你解決這個問題。\n了解更多,可訪問該模組的 <a href="https://github.com/Fuzss/nightconfigfixes">GitHub 倉庫</a>。
game.crash.reason.night_config_fixes=目前遊戲由於 Night Config 庫的一些問題,無法繼續執行。\n你可以嘗試安裝 <a href="https://www.curseforge.com/minecraft/mc-mods/night-config-fixes">Night Config Fixes</a> 模組,這或許能幫助你解決這個問題。\n了解更多,可訪問該模組的 <a href="https://github.com/Fuzss/nightconfigfixes">GitHub 儲存庫</a>。
game.crash.reason.mod_files_are_decompressed=目前遊戲由於模組檔案被解壓了,無法繼續執行。\n請直接把整個模組檔案放進模組目錄中即可。\n解壓模組檔案會導致遊戲出錯。請刪除模組目錄中已被解壓的模組,然後再啟動遊戲。
game.crash.reason.too_many_mods_lead_to_exceeding_the_id_limit=目前遊戲由於你所安裝的模組過多,超出了遊戲的 ID 限制,無法繼續執行。\n請嘗試安裝<a href="https://www.curseforge.com/minecraft/mc-mods/jeid">JEID</a>等修正模組,或刪除部分大型模組。
game.crash.reason.optifine_causes_the_world_to_fail_to_load=目前遊戲可能由於 OptiFine 而無法繼續執行。\n該問題只在特定 OptiFine 版本中出現,你可以嘗試在「實例管理 → 自動安裝」中更換 OptiFine 的版本。
@@ -691,6 +691,7 @@ message.info=提示
message.success=完成
message.unknown=未知
message.warning=警告
message.question=確認
modpack=模組包
modpack.choose=選取要安裝的遊戲模組包檔案
@@ -862,7 +863,7 @@ mods.add.failed=新增模組「%s」失敗。
mods.add.success=成功新增模組「%s」。
mods.add.title=選取要新增的模組檔案
mods.broken_dependency.title=損壞的相依模組
mods.broken_dependency.desc=該相依模組曾經存在於模組倉庫中,但現在已被刪除,請嘗試其他下載源。
mods.broken_dependency.desc=該相依模組曾經存在於模組儲存庫中,但現在已被刪除,請嘗試其他下載源。
mods.category=類別
mods.channel.alpha=Alpha
mods.channel.beta=Beta
@@ -884,7 +885,7 @@ mods.dependency.required=必需相依模組 (必須單獨下載,缺少可能
mods.dependency.tool=相依庫 (必須單獨下載,缺少可能會導致遊戲無法啟動)
mods.dependency.include=內建相依模組 (作者已經打包在模組檔中,無需單獨下載)
mods.dependency.incompatible=不相容模組 (同時安裝此模組和正在下載的模組會導致遊戲無法啟動)
mods.dependency.broken=損壞的相依模組 (該模組曾經存在於模組倉庫中,但現在已被刪除,請嘗試其他下載源)
mods.dependency.broken=損壞的相依模組 (該模組曾經存在於模組儲存庫中,但現在已被刪除,請嘗試其他下載源)
mods.disable=停用
mods.download=模組下載
mods.download.title=模組下載 - %1s
@@ -1030,9 +1031,9 @@ profile.title=遊戲目錄
profile.selected=已選取
profile.use_relative_path=如可行,則對於遊戲目錄使用相對路徑
repositories.custom=自訂 Maven 倉庫 (%s)
repositories.custom=自訂 Maven 儲存庫 (%s)
repositories.maven_central=全球 (Maven Central)
repositories.tencentcloud_mirror=中國大陸 (騰訊雲 Maven 倉庫)
repositories.tencentcloud_mirror=中國大陸 (騰訊雲 Maven 儲存庫)
repositories.chooser=缺少 JavaFX 執行環境。HMCL 需要 JavaFX 才能正常執行。\n點擊「確認」從指定下載源下載 JavaFX 執行時元件並開啟 HMCL。點擊「取消」退出程式。\n選取下載源:
repositories.chooser.title=選取 JavaFX 下載源
@@ -1280,7 +1281,7 @@ terracotta.difficulty.easiest=目前網路狀況極佳:稍等一下就成功
terracotta.difficulty.simple=目前網路狀況較好:建立連線需要一段時間…
terracotta.difficulty.medium=目前網路狀態中等:已啟用抗干擾備用線路,連線可能失敗
terracotta.difficulty.tough=目前網路狀態極差:已啟用抗干擾備用線路,連線可能失敗
terracotta.difficulty.estimate_only=連接成功率由房主和房客的 NAT 類型推算得到,僅供參考。
terracotta.difficulty.estimate_only=連線成功率由房主和房客的 NAT 類型推算得到,僅供參考。
terracotta.from_local.title=線上核心第三方下載管道
terracotta.from_local.desc=在部分地區,內建的預設下載管道可能不穩定或連線緩慢
terracotta.from_local.guide=您應下載名為 %s 的線上核心套件。下載完成後,請將檔案拖曳到目前介面來安裝。
@@ -1339,7 +1340,7 @@ terracotta.status.fatal.network=未能下載線上核心。請檢查網路連接
terracotta.status.fatal.install=嚴重錯誤:無法安裝線上核心
terracotta.status.fatal.terracotta=嚴重錯誤:無法與線上核心通訊
terracotta.status.fatal.unknown=嚴重錯誤:原因未知
terracotta.player_list=玩家列表
terracotta.player_list=玩家清單
terracotta.player_anonymous=匿名玩家
terracotta.player_kind.host=房主
terracotta.player_kind.local=你
@@ -1348,7 +1349,7 @@ terracotta.unsupported=多人聯機功能尚未支援目前平台。
terracotta.unsupported.os.windows.old=多人聯機功能需要 Windows 10 或更高版本。請更新系統。
terracotta.unsupported.arch.32bit=多人聯機功能不支援 32 位元系統。請更新至 64 位元系統。
terracotta.unsupported.arch.loongarch64_ow=多人聯機功能不支援 Linux LoongArch64 舊世界發行版,請更新至新世界發行版 (如 AOSC OC)。
terracotta.unsupported.region=多人聯機功能目前僅為中國內地用戶提供服務,在您所在地區可能不可用。
terracotta.unsupported.region=多人聯機功能目前僅為中國內地使用者提供服務,在您所在地區可能不可用。
unofficial.hint=你正在使用第三方提供的 HMCL。我們無法保證其安全性,請注意甄別。
@@ -1,6 +1,6 @@
#
# Hello Minecraft! Launcher
# Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
# Copyright (C) 2026 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
@@ -20,7 +20,7 @@
about=关于
about.copyright=版权
about.copyright.statement=版权所有 © 2026 huangyuhui
about.copyright.statement=版权所有 © 2013-2026 huangyuhui 及贡献者
about.author=作者
about.author.statement=bilibili @huanghongxun
about.claim=用户协议
@@ -411,7 +411,7 @@ fatal.deprecated_java_version=HMCL 未来需要 Java 17 或更高版本才能运
fatal.deprecated_java_version.update=更高版本的 HMCL 需要 Java 17 或更高版本才能运行,请安装最新版本的 Java 以确保 HMCL 能够完成升级。\n你可以继续保留旧版本 Java。HMCL 能够识别与管理多个 Java,并会自动根据游戏版本为你选择合适的 Java。
fatal.deprecated_java_version.download_link=下载 Java %d
fatal.samba=如果你正在通过 Samba 共享的文件夹中运行 Hello Minecraft! Launcher,启动器可能无法正常工作。请尝试更新你的 Java 或在本地文件夹内运行 HMCL。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。
fatal.illegal_char=由于你的用户文件夹路径中存在非法字符“=”,你将无法使用外置登录账户以及离线登录更换皮肤功能。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。
fatal.illegal_char=由于你的运行路径中存在非法字符“=”,你将无法使用外置登录账户以及离线登录更换皮肤功能。\n你可以访问 https://docs.hmcl.net/help.html 页面寻求帮助。
fatal.unsupported_platform=Minecraft 尚未对你的平台提供完善支持,所以可能影响游戏体验或无法启动游戏。\n\
若无法启动 Minecraft 1.17 及更高版本,可以尝试在“(全局/实例特定) 游戏设置 → 高级设置 → 调试选项”中将“渲染器”切换为“Mesa LLVMpipe”,以获得更好的兼容性。\n\
如遇到问题,你可以点击右上角帮助按钮进行求助。
@@ -696,6 +696,7 @@ message.info=提示
message.success=完成
message.unknown=未知
message.warning=警告
message.question=确认
modpack=整合包
modpack.choose=选择要安装的游戏整合包文件
@@ -2661,6 +2661,34 @@
}
},
"org.lwjgl:lwjgl-freetype:3.3.3:natives-linux": null,
"org.lwjgl:lwjgl:3.4.1:natives-linux": {
"name": "org.glavo.hmcl:lwjgl3-natives:3.4.1-rc1",
"downloads": {
"classifiers": {
"linux-loongarch64": {
"path": "org/glavo/hmcl/lwjgl3-natives/3.4.1-rc1/lwjgl3-natives-3.4.1-rc1-linux-loongarch64.jar",
"url": "https://repo1.maven.org/maven2/org/glavo/hmcl/lwjgl3-natives/3.4.1-rc1-linux-loongarch64/lwjgl3-natives-3.4.1-rc1-linux-loongarch64.jar",
"sha1": "3fed872fc2f9929d2be25389dd312dfb48e9f89e",
"size": 22854580
}
}
},
"extract": {
"exclude": [
"META-INF/"
]
},
"natives": {
"linux": "linux-loongarch64"
}
},
"org.lwjgl:lwjgl-jemalloc:3.4.1:natives-linux": null,
"org.lwjgl:lwjgl-openal:3.4.1:natives-linux": null,
"org.lwjgl:lwjgl-opengl:3.4.1:natives-linux": null,
"org.lwjgl:lwjgl-glfw:3.4.1:natives-linux": null,
"org.lwjgl:lwjgl-stb:3.4.1:natives-linux": null,
"org.lwjgl:lwjgl-tinyfd:3.4.1:natives-linux": null,
"org.lwjgl:lwjgl-freetype:3.4.1:natives-linux": null,
"net.java.dev.jna:jna:5.8.0": {
"name": "net.java.dev.jna:jna:5.13.0",
"downloads": {
@@ -93,13 +93,12 @@ public final class BMCLAPIDownloadProvider implements DownloadProvider {
pair("https://repo.maven.apache.org/maven2", "https://mirrors.cloud.tencent.com/nexus/repository/maven-public"),
pair("https://hmcl.glavo.site/metadata/cleanroom", "https://alist.8mi.tech/d/mirror/HMCL-Metadata/Auto/cleanroom"),
pair("https://hmcl.glavo.site/metadata/fmllibs", "https://alist.8mi.tech/d/mirror/HMCL-Metadata/Auto/fmllibs"),
pair("https://zkitefly.github.io/unlisted-versions-of-minecraft", "https://alist.8mi.tech/d/mirror/unlisted-versions-of-minecraft/Auto")
// // https://github.com/mcmod-info-mirror/mcim-rust-api
// pair("https://api.modrinth.com", "https://mod.mcimirror.top/modrinth"),
// pair("https://cdn.modrinth.com", "https://mod.mcimirror.top"),
// pair("https://api.curseforge.com", "https://mod.mcimirror.top/curseforge"),
// pair("https://edge.forgecdn.net", "https://mod.mcimirror.top"),
// pair("https://mediafilez.forgecdn.net", "https://mod.mcimirror.top")
pair("https://zkitefly.github.io/unlisted-versions-of-minecraft", "https://alist.8mi.tech/d/mirror/unlisted-versions-of-minecraft/Auto"),
// https://github.com/mcmod-info-mirror/mcim-rust-api
pair("https://api.modrinth.com", "https://mod.mcimirror.top/modrinth"),
pair("https://cdn.modrinth.com", "https://mod.mcimirror.top"),
pair("https://api.curseforge.com", "https://mod.mcimirror.top/curseforge"),
pair("https://edge.forgecdn.net", "https://mod.mcimirror.top")
);
}
@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.game;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
import org.jackhuang.hmcl.java.JavaInfo;
import org.jackhuang.hmcl.util.logging.Logger;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
@@ -128,7 +129,20 @@ public final class GameDumpGenerator {
}
private static void writeDumpBodyTo(VirtualMachine vm, Writer writer) throws IOException {
execute(vm, "Thread.print -e -l", writer);
int vmVersion = -1;
try {
if (vm.getSystemProperties().get("java.version") instanceof String javaVersion)
vmVersion = JavaInfo.parseVersion(javaVersion);
} catch (Throwable e) {
LOG.warning("Failed to get VM system properties", e);
}
if (vmVersion >= 11)
execute(vm, "Thread.print -e -l", writer);
else
execute(vm, "Thread.print -l", writer);
}
private static VirtualMachine attachVM(String lvmid, Writer writer) throws IOException, InterruptedException {
@@ -34,6 +34,7 @@ import java.nio.channels.OverlappingFileLockException;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.List;
import java.util.UUID;
import java.util.stream.Stream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -44,10 +45,18 @@ public final class World {
private final Path file;
private String fileName;
private CompoundTag levelData;
private Image icon;
private CompoundTag levelData;
private Path levelDataPath;
private CompoundTag worldGenSettingsDataBackingTag; // Use for writing back to the file
private CompoundTag normalizedWorldGenSettingsData; // Use for reading/modification
private Path worldGenSettingsDataPath;
private CompoundTag playerData; // Use for both reading/modification and writing back to the file
private Path playerDataPath;
public World(Path file) throws IOException {
this.file = file;
@@ -76,14 +85,10 @@ public final class World {
public void setWorldName(String worldName) throws IOException {
if (levelData.get("Data") instanceof CompoundTag data && data.get("LevelName") instanceof StringTag levelNameTag) {
levelNameTag.setValue(worldName);
writeLevelDat(levelData);
writeLevelData();
}
}
public Path getLevelDatFile() {
return file.resolve("level.dat");
}
public Path getSessionLockFile() {
return file.resolve("session.lock");
}
@@ -92,6 +97,14 @@ public final class World {
return levelData;
}
public @Nullable CompoundTag getNormalizedWorldGenSettingsData() {
return normalizedWorldGenSettingsData;
}
public @Nullable CompoundTag getPlayerData() {
return playerData;
}
public long getLastPlayed() {
CompoundTag data = levelData.get("Data");
LongTag lastPlayedTag = data.get("LastPlayed");
@@ -108,10 +121,12 @@ public final class World {
}
public @Nullable Long getSeed() {
CompoundTag data = levelData.get("Data");
if (data.get("WorldGenSettings") instanceof CompoundTag worldGenSettingsTag && worldGenSettingsTag.get("seed") instanceof LongTag seedTag) { //Valid after 1.16
// Valid after 1.16(20w20a)
if (normalizedWorldGenSettingsData != null && normalizedWorldGenSettingsData.get("seed") instanceof LongTag seedTag) {
return seedTag.getValue();
} else if (data.get("RandomSeed") instanceof LongTag seedTag) { //Valid before 1.16
}
// Valid before 1.16(20w20a)
if (levelData.get("Data") instanceof CompoundTag data && data.get("RandomSeed") instanceof LongTag seedTag) {
return seedTag.getValue();
}
return null;
@@ -119,22 +134,28 @@ public final class World {
public boolean isLargeBiomes() {
CompoundTag data = levelData.get("Data");
if (data.get("generatorName") instanceof StringTag generatorNameTag) { //Valid before 1.16
// Valid before 1.16(20w20a)
if (data.get("generatorName") instanceof StringTag generatorNameTag) {
return "largeBiomes".equals(generatorNameTag.getValue());
} else {
if (data.get("WorldGenSettings") instanceof CompoundTag worldGenSettingsTag
&& worldGenSettingsTag.get("dimensions") instanceof CompoundTag dimensionsTag
&& dimensionsTag.get("minecraft:overworld") instanceof CompoundTag overworldTag
}
// Unified handling of logic after version 1.16
else if (normalizedWorldGenSettingsData != null
&& normalizedWorldGenSettingsData.get("dimensions") instanceof CompoundTag dimensionsTag) {
if (dimensionsTag.get("minecraft:overworld") instanceof CompoundTag overworldTag
&& overworldTag.get("generator") instanceof CompoundTag generatorTag) {
// Valid between 1.16(20w20a) and 1.18(21w37a)
if (generatorTag.get("biome_source") instanceof CompoundTag biomeSourceTag
&& biomeSourceTag.get("large_biomes") instanceof ByteTag largeBiomesTag) { //Valid between 1.16 and 1.16.2
&& biomeSourceTag.get("large_biomes") instanceof ByteTag largeBiomesTag) {
return largeBiomesTag.getValue() == (byte) 1;
} else if (generatorTag.get("settings") instanceof StringTag settingsTag) { //Valid after 1.16.2
}
// Valid after 1.18(21w37a)
else if (generatorTag.get("settings") instanceof StringTag settingsTag) {
return "minecraft:large_biomes".equals(settingsTag.getValue());
}
}
return false;
}
return false;
}
public Image getIcon() {
@@ -166,8 +187,8 @@ public final class World {
if (!Files.exists(levelDat)) {
throw new IOException("Not a valid world directory since level.dat or special_level.dat cannot be found.");
}
loadAndCheckLevelDat(levelDat);
this.levelDataPath = levelDat;
loadAndCheckWorldData();
Path iconFile = file.resolve("icon.png");
if (Files.isRegularFile(iconFile)) {
@@ -189,7 +210,7 @@ public final class World {
if (!Files.exists(levelDat)) {
throw new IOException("Not a valid world zip file since level.dat or special_level.dat cannot be found.");
}
loadAndCheckLevelDat(levelDat);
loadAndCheckLevelData(levelDat);
Path iconFile = root.resolve("icon.png");
if (Files.isRegularFile(iconFile)) {
@@ -221,8 +242,13 @@ public final class World {
}
}
private void loadAndCheckLevelDat(Path levelDat) throws IOException {
this.levelData = parseLevelDat(levelDat);
private void loadAndCheckWorldData() throws IOException {
loadAndCheckLevelData(levelDataPath);
loadOtherData();
}
private void loadAndCheckLevelData(Path levelDat) throws IOException {
this.levelData = readTag(levelDat);
CompoundTag data = levelData.get("Data");
if (data == null)
throw new IOException("level.dat missing Data");
@@ -234,10 +260,54 @@ public final class World {
throw new IOException("level.dat missing LastPlayed");
}
public void reloadLevelDat() throws IOException {
if (levelDataPath != null) {
loadAndCheckLevelDat(this.levelDataPath);
private void loadOtherData() throws IOException {
if (!(levelData.get("Data") instanceof CompoundTag data)) return;
Path worldGenSettingsDatPath = file.resolve("data/minecraft/world_gen_settings.dat");
if (data.get("WorldGenSettings") instanceof CompoundTag worldGenSettingsTag) {
setWorldGenSettingsData(null, worldGenSettingsTag, worldGenSettingsTag);
} else if (Files.isRegularFile(worldGenSettingsDatPath)) {
CompoundTag raw = readTag(worldGenSettingsDatPath);
if (raw.get("data") instanceof CompoundTag compoundTag) {
setWorldGenSettingsData(worldGenSettingsDatPath, raw, compoundTag);
} else {
setWorldGenSettingsData(null, null, null);
}
} else {
setWorldGenSettingsData(null, null, null);
}
if (data.get("Player") instanceof CompoundTag playerTag) {
setPlayerData(null, playerTag);
} else if (data.get("singleplayer_uuid") instanceof IntArrayTag uuidTag && uuidTag.getValue().length == 4) {
int[] uuidValue = uuidTag.getValue();
long mostSigBits = ((long) uuidValue[0] << 32) | (uuidValue[1] & 0xFFFFFFFFL);
long leastSigBits = ((long) uuidValue[2] << 32) | (uuidValue[3] & 0xFFFFFFFFL);
String playerUUID = new UUID(mostSigBits, leastSigBits).toString();
Path playerDatPath = file.resolve("players/data/" + playerUUID + ".dat");
if (Files.exists(playerDatPath)) {
setPlayerData(playerDatPath, readTag(playerDatPath));
} else {
setPlayerData(null, null);
}
} else {
setPlayerData(null, null);
}
}
private void setWorldGenSettingsData(Path worldGenSettingsDataPath, CompoundTag worldGenSettingsDataBackingTag, CompoundTag unifiedWorldGenSettingsData) {
this.worldGenSettingsDataPath = worldGenSettingsDataPath;
this.worldGenSettingsDataBackingTag = worldGenSettingsDataBackingTag;
this.normalizedWorldGenSettingsData = unifiedWorldGenSettingsData;
}
private void setPlayerData(Path playerDataPath, CompoundTag playerData) {
this.playerDataPath = playerDataPath;
this.playerData = playerData;
}
public void reloadWorldData() throws IOException {
loadAndCheckWorldData();
}
// The rename method is used to rename temporary world object during installation and copying,
@@ -249,7 +319,7 @@ public final class World {
// Change the name recorded in level.dat
CompoundTag data = levelData.get("Data");
data.put(new StringTag("LevelName", newName));
writeLevelDat(levelData);
writeLevelData();
// then change the folder's name
Files.move(file, file.resolveSibling(newName));
@@ -345,27 +415,41 @@ public final class World {
}
}
public void writeLevelDat(CompoundTag nbt) throws IOException {
if (!Files.isDirectory(file))
throw new IOException("Not a valid world directory");
public void writeWorldData() throws IOException {
if (!Files.isDirectory(file)) throw new IOException("Not a valid world directory");
FileUtils.saveSafely(getLevelDatFile(), os -> {
writeLevelData();
if (worldGenSettingsDataPath != null && worldGenSettingsDataBackingTag != null) {
writeTag(worldGenSettingsDataBackingTag, worldGenSettingsDataPath);
}
if (playerDataPath != null && playerData != null) {
writeTag(playerData, playerDataPath);
}
}
public void writeLevelData() throws IOException {
writeTag(levelData, levelDataPath);
}
private CompoundTag readTag(Path path) throws IOException {
try (InputStream is = new GZIPInputStream(Files.newInputStream(path))) {
Tag tag = NBTIO.readTag(is);
if (tag instanceof CompoundTag compoundTag) return compoundTag;
throw new IOException("NBT file malformed: " + path);
}
}
private void writeTag(CompoundTag nbt, Path path) throws IOException {
if (!Files.isDirectory(file)) throw new IOException("Not a valid world directory");
FileUtils.saveSafely(path, os -> {
try (OutputStream gos = new GZIPOutputStream(os)) {
NBTIO.writeTag(gos, nbt);
}
});
}
private static CompoundTag parseLevelDat(Path path) throws IOException {
try (InputStream is = new GZIPInputStream(Files.newInputStream(path))) {
Tag nbt = NBTIO.readTag(is);
if (nbt instanceof CompoundTag compoundTag)
return compoundTag;
else
throw new IOException("level.dat malformed");
}
}
private static boolean isLocked(Path sessionLockFile) {
try (FileChannel fileChannel = FileChannel.open(sessionLockFile, StandardOpenOption.WRITE)) {
return fileChannel.tryLock() == null;
@@ -382,14 +466,17 @@ public final class World {
public static List<World> getWorlds(Path savesDir) {
if (Files.exists(savesDir)) {
try (Stream<Path> stream = Files.list(savesDir)) {
return stream.flatMap(world -> {
try {
return Stream.of(new World(world.toAbsolutePath().normalize()));
} catch (IOException e) {
LOG.warning("Failed to read world " + world, e);
return Stream.empty();
}
}).toList();
return stream
.filter(Files::isDirectory)
.flatMap(world -> {
try {
return Stream.of(new World(world.toAbsolutePath().normalize()));
} catch (IOException e) {
LOG.warning("Failed to read world " + world, e);
return Stream.empty();
}
})
.toList();
} catch (IOException e) {
LOG.warning("Failed to read saves", e);
}
@@ -650,8 +650,10 @@ public class DefaultLauncher extends Launcher {
final String command = usePowerShell ? null : commandLine.commandLine.toString();
Map<String, String> envVars = getEnvVars();
if (!usePowerShell && isWindows) {
if (command.length() > 8192) { // maximum length of the command in cmd
if (isWindows && !usePowerShell) {
// https://stackoverflow.com/a/28452546
// https://learn.microsoft.com/troubleshoot/windows-client/shell-experience/command-line-string-limitation
if (command.length() > 32767) {
throw new CommandTooLongException();
}
}
@@ -210,6 +210,7 @@ public class ModpackExportInfo {
}
public static class Options {
private boolean requireAuthor;
private boolean requireUrl;
private boolean requireForceUpdate;
private boolean requireFileApi;
@@ -225,6 +226,10 @@ public class ModpackExportInfo {
public Options() {
}
public boolean isRequireAuthor() {
return requireAuthor;
}
public boolean isRequireUrl() {
return requireUrl;
}
@@ -269,6 +274,11 @@ public class ModpackExportInfo {
return requireSkipCurseForgeRemoteFiles;
}
public Options requireAuthor() {
requireAuthor = true;
return this;
}
public Options requireUrl() {
requireUrl = true;
return this;
@@ -115,19 +115,19 @@ public final class CurseCompletionTask extends Task<Void> {
// Because in China, Curse is too difficult to visit,
// if failed, ignore it and retry next time.
CurseManifest newManifest = manifest.setFiles(
manifest.getFiles().parallelStream()
manifest.files().parallelStream()
.map(file -> {
updateProgress(finished.incrementAndGet(), manifest.getFiles().size());
if (StringUtils.isBlank(file.getFileName()) || file.getUrl() == null) {
updateProgress(finished.incrementAndGet(), manifest.files().size());
if (StringUtils.isBlank(file.fileName()) || file.url() == null) {
try {
RemoteMod.File remoteFile = CurseForgeRemoteModRepository.MODS.getModFile(Integer.toString(file.getProjectID()), Integer.toString(file.getFileID()));
RemoteMod.File remoteFile = CurseForgeRemoteModRepository.MODS.getModFile(Integer.toString(file.projectID()), Integer.toString(file.fileID()));
return file.withFileName(remoteFile.getFilename()).withURL(remoteFile.getUrl());
} catch (FileNotFoundException fof) {
LOG.warning("Could not query api.curseforge.com for deleted mods: " + file.getProjectID() + ", " + file.getFileID(), fof);
LOG.warning("Could not query api.curseforge.com for deleted mods: " + file.projectID() + ", " + file.fileID(), fof);
notFound.set(true);
return file;
} catch (IOException | JsonParseException e) {
LOG.warning("Unable to fetch the file name projectID=" + file.getProjectID() + ", fileID=" + file.getFileID(), e);
LOG.warning("Unable to fetch the file name projectID=" + file.projectID() + ", fileID=" + file.fileID(), e);
allNameKnown.set(false);
return file;
}
@@ -142,9 +142,9 @@ public final class CurseCompletionTask extends Task<Void> {
Path resourcePacksRoot = versionRoot.resolve("resourcepacks");
Path shaderPacksRoot = versionRoot.resolve("shaderpacks");
finished.set(0);
dependencies = newManifest.getFiles()
dependencies = newManifest.files()
.stream().parallel()
.filter(f -> f.getFileName() != null)
.filter(f -> f.fileName() != null)
.flatMap(f -> {
try {
Path path = guessFilePath(f, resourcePacksRoot, shaderPacksRoot);
@@ -152,15 +152,15 @@ public final class CurseCompletionTask extends Task<Void> {
return Stream.empty();
}
var task = new FileDownloadTask(f.getUrl(), path);
var task = new FileDownloadTask(f.url(), path);
task.setCacheRepository(dependency.getCacheRepository());
task.setCaching(true);
return Stream.of(task.withCounter("hmcl.modpack.download"));
} catch (IOException e) {
LOG.warning("Could not query api.curseforge.com for mod: " + f.getProjectID() + ", " + f.getFileID(), e);
LOG.warning("Could not query api.curseforge.com for mod: " + f.projectID() + ", " + f.fileID(), e);
return Stream.empty(); // Ignore this file.
} finally {
updateProgress(finished.incrementAndGet(), newManifest.getFiles().size());
updateProgress(finished.incrementAndGet(), newManifest.files().size());
}
})
.collect(Collectors.toList());
@@ -181,9 +181,9 @@ public final class CurseCompletionTask extends Task<Void> {
* @throws IOException If IOException was encountered during getting data from CurseForge.
*/
private Path guessFilePath(CurseManifestFile file, Path resourcePacksRoot, Path shaderPacksRoot) throws IOException {
RemoteMod mod = CurseForgeRemoteModRepository.MODS.getModById(Integer.toString(file.getProjectID()));
RemoteMod mod = CurseForgeRemoteModRepository.MODS.getModById(Integer.toString(file.projectID()));
int classID = ((CurseAddon) mod.getData()).getClassId();
String fileName = file.getFileName();
String fileName = file.fileName();
return switch (classID) {
case 12, // Resource pack
6552 -> { // Shader pack
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
@@ -42,6 +43,7 @@ import java.util.stream.Stream;
import static org.jackhuang.hmcl.util.Lang.mapOf;
import static org.jackhuang.hmcl.util.Pair.pair;
import static org.jackhuang.hmcl.util.gson.JsonUtils.listTypeOf;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
public final class CurseForgeRemoteModRepository implements RemoteModRepository {
@@ -131,10 +133,34 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository
query.put("index", Integer.toString(pageOffset * pageSize));
query.put("pageSize", Integer.toString(pageSize));
Response<List<CurseAddon>> response = withApiKey(HttpRequest.GET(downloadProvider.injectURL(NetworkUtils.withQuery(PREFIX + "/v1/mods/search", query))))
.getJson(Response.typeOf(listTypeOf(CurseAddon.class)));
if (searchFilter.isEmpty()) {
return new SearchResult(response.getData().stream().map(CurseAddon::toMod), calculateTotalPages(response, pageSize));
Response<List<CurseAddon>> response = null;
IOException exception = null;
List<URI> candidates = downloadProvider.injectURLWithCandidates(NetworkUtils.withQuery(PREFIX + "/v1/mods/search", query));
for (URI candidate : candidates) {
LOG.info("Fetching " + candidate);
try {
response = withApiKey(HttpRequest.GET(candidate.toString()))
.getJson(Response.typeOf(listTypeOf(CurseAddon.class)));
if (searchFilter.isEmpty()) {
return new SearchResult(response.getData().stream().map(CurseAddon::toMod), calculateTotalPages(response, pageSize));
}
break;
} catch (IOException e) {
LOG.warning("Failed to search addons: " + candidate, e);
if (candidates.size() == 1) {
exception = e;
} else {
if (exception == null) {
exception = new IOException("Failed to search addons");
}
exception.addSuppressed(e);
}
}
}
if (response == null) {
throw exception != null ? exception : new IOException("No candidates found");
}
// https://github.com/HMCL-dev/HMCL/issues/1549
@@ -73,14 +73,14 @@ public final class CurseInstallTask extends Task<Void> {
if (repository.hasVersion(name) && Files.notExists(json))
throw new IllegalArgumentException("Version " + name + " already exists.");
GameBuilder builder = dependencyManager.gameBuilder().name(name).gameVersion(manifest.getMinecraft().getGameVersion());
for (CurseManifestModLoader modLoader : manifest.getMinecraft().getModLoaders()) {
if (modLoader.getId().startsWith("forge-")) {
builder.version("forge", modLoader.getId().substring("forge-".length()));
} else if (modLoader.getId().startsWith("fabric-")) {
builder.version("fabric", modLoader.getId().substring("fabric-".length()));
} else if (modLoader.getId().startsWith("neoforge-")) {
builder.version("neoforge", modLoader.getId().substring("neoforge-".length()));
GameBuilder builder = dependencyManager.gameBuilder().name(name).gameVersion(manifest.minecraft().gameVersion());
for (CurseManifestModLoader modLoader : manifest.minecraft().modLoaders()) {
if (modLoader.id().startsWith("forge-")) {
builder.version("forge", modLoader.id().substring("forge-".length()));
} else if (modLoader.id().startsWith("fabric-")) {
builder.version("fabric", modLoader.id().substring("fabric-".length()));
} else if (modLoader.id().startsWith("neoforge-")) {
builder.version("neoforge", modLoader.id().substring("neoforge-".length()));
}
}
dependents.add(builder.buildAsync());
@@ -105,8 +105,8 @@ public final class CurseInstallTask extends Task<Void> {
} catch (JsonParseException | IOException ignore) {
}
this.config = config;
dependents.add(new ModpackInstallTask<>(zipFile, run, modpack.getEncoding(), Collections.singletonList(manifest.getOverrides()), any -> true, config).withStage("hmcl.modpack"));
dependents.add(new MinecraftInstanceTask<>(zipFile, modpack.getEncoding(), Collections.singletonList(manifest.getOverrides()), manifest, CurseModpackProvider.INSTANCE, manifest.getName(), manifest.getVersion(), repository.getModpackConfiguration(name)).withStage("hmcl.modpack"));
dependents.add(new ModpackInstallTask<>(zipFile, run, modpack.getEncoding(), Collections.singletonList(manifest.overrides()), any -> true, config).withStage("hmcl.modpack"));
dependents.add(new MinecraftInstanceTask<>(zipFile, modpack.getEncoding(), Collections.singletonList(manifest.overrides()), manifest, CurseModpackProvider.INSTANCE, manifest.name(), manifest.version(), repository.getModpackConfiguration(name)).withStage("hmcl.modpack"));
dependencies.add(new CurseCompletionTask(dependencyManager, name, manifest));
}
@@ -125,11 +125,11 @@ public final class CurseInstallTask extends Task<Void> {
public void execute() throws Exception {
if (config != null) {
// For update, remove mods not listed in new manifest
for (CurseManifestFile oldCurseManifestFile : config.getManifest().getFiles()) {
if (StringUtils.isBlank(oldCurseManifestFile.getFileName())) continue;
Path oldFile = run.resolve("mods/" + oldCurseManifestFile.getFileName());
for (CurseManifestFile oldCurseManifestFile : config.getManifest().files()) {
if (StringUtils.isBlank(oldCurseManifestFile.fileName())) continue;
Path oldFile = run.resolve("mods/" + oldCurseManifestFile.fileName());
if (Files.notExists(oldFile)) continue;
if (manifest.getFiles().stream().noneMatch(oldCurseManifestFile::equals))
if (manifest.files().stream().noneMatch(oldCurseManifestFile::equals))
Files.deleteIfExists(oldFile);
}
}
@@ -20,88 +20,21 @@ package org.jackhuang.hmcl.mod.curse;
import com.google.gson.annotations.SerializedName;
import org.jackhuang.hmcl.mod.ModpackManifest;
import org.jackhuang.hmcl.mod.ModpackProvider;
import org.jackhuang.hmcl.util.Immutable;
import org.jackhuang.hmcl.util.gson.JsonSerializable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collections;
import java.util.List;
/**
*
* @author huangyuhui
*/
@Immutable
public final class CurseManifest implements ModpackManifest {
@SerializedName("manifestType")
private final String manifestType;
@SerializedName("manifestVersion")
private final int manifestVersion;
@SerializedName("name")
private final String name;
@SerializedName("version")
private final String version;
@SerializedName("author")
private final String author;
@SerializedName("overrides")
private final String overrides;
@SerializedName("minecraft")
private final CurseManifestMinecraft minecraft;
@SerializedName("files")
private final List<CurseManifestFile> files;
public CurseManifest() {
this(MINECRAFT_MODPACK, 1, "", "1.0", "", "overrides", new CurseManifestMinecraft(), Collections.emptyList());
}
public CurseManifest(String manifestType, int manifestVersion, String name, String version, String author, String overrides, CurseManifestMinecraft minecraft, List<CurseManifestFile> files) {
this.manifestType = manifestType;
this.manifestVersion = manifestVersion;
this.name = name;
this.version = version;
this.author = author;
this.overrides = overrides;
this.minecraft = minecraft;
this.files = files;
}
public String getManifestType() {
return manifestType;
}
public int getManifestVersion() {
return manifestVersion;
}
public String getName() {
return name;
}
public String getVersion() {
return version;
}
public String getAuthor() {
return author;
}
public String getOverrides() {
return overrides;
}
public CurseManifestMinecraft getMinecraft() {
return minecraft;
}
public List<CurseManifestFile> getFiles() {
return files;
}
/// @author huangyuhui
@JsonSerializable
public record CurseManifest(@SerializedName("manifestType") String manifestType,
@SerializedName("manifestVersion") int manifestVersion,
@SerializedName("name") String name,
@SerializedName("version") String version,
@SerializedName("author") String author,
@SerializedName("overrides") String overrides,
@SerializedName("minecraft") CurseManifestMinecraft minecraft,
@SerializedName("files") @Unmodifiable List<CurseManifestFile> files) implements ModpackManifest {
public CurseManifest setFiles(List<CurseManifestFile> files) {
return new CurseManifest(manifestType, manifestVersion, name, version, author, overrides, minecraft, files);
@@ -19,61 +19,19 @@ package org.jackhuang.hmcl.mod.curse;
import com.google.gson.JsonParseException;
import com.google.gson.annotations.SerializedName;
import org.jackhuang.hmcl.util.Immutable;
import org.jackhuang.hmcl.util.gson.JsonSerializable;
import org.jackhuang.hmcl.util.gson.Validation;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
/**
*
* @author huangyuhui
*/
@Immutable
public final class CurseManifestFile implements Validation {
@SerializedName("projectID")
private final int projectID;
@SerializedName("fileID")
private final int fileID;
@SerializedName("fileName")
private final String fileName;
@SerializedName("url")
private final String url;
@SerializedName("required")
private final boolean required;
public CurseManifestFile() {
this(0, 0, null, null, true);
}
public CurseManifestFile(int projectID, int fileID, String fileName, String url, boolean required) {
this.projectID = projectID;
this.fileID = fileID;
this.fileName = fileName;
this.url = url;
this.required = required;
}
public int getProjectID() {
return projectID;
}
public int getFileID() {
return fileID;
}
public String getFileName() {
return fileName;
}
public boolean isRequired() {
return required;
}
/// @author huangyuhui
@JsonSerializable
public record CurseManifestFile(@SerializedName("projectID") int projectID,
@SerializedName("fileID") int fileID,
@SerializedName("fileName") String fileName,
@SerializedName("url") String url,
@SerializedName("required") boolean required) implements Validation {
@Override
public void validate() throws JsonParseException {
@@ -81,8 +39,9 @@ public final class CurseManifestFile implements Validation {
throw new JsonParseException("Missing Project ID or File ID.");
}
@Override
@Nullable
public String getUrl() {
public String url() {
if (url == null) {
return fileName != null
? String.format("https://edge.forgecdn.net/files/%d/%d/%s", fileID / 1000, fileID % 1000, fileName)
@@ -102,11 +61,9 @@ public final class CurseManifestFile implements Validation {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CurseManifestFile that = (CurseManifestFile) o;
return projectID == that.projectID &&
fileID == that.fileID;
return this == o || o instanceof CurseManifestFile that
&& this.projectID == that.projectID
&& this.fileID == that.fileID;
}
@Override
@@ -19,42 +19,27 @@ package org.jackhuang.hmcl.mod.curse;
import com.google.gson.JsonParseException;
import com.google.gson.annotations.SerializedName;
import org.jackhuang.hmcl.util.Immutable;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.gson.JsonSerializable;
import org.jackhuang.hmcl.util.gson.Validation;
import org.jetbrains.annotations.Unmodifiable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
*
* @author huangyuhui
*/
@Immutable
public final class CurseManifestMinecraft implements Validation {
@SerializedName("version")
private final String gameVersion;
@SerializedName("modLoaders")
private final List<CurseManifestModLoader> modLoaders;
public CurseManifestMinecraft() {
this.gameVersion = "";
this.modLoaders = Collections.emptyList();
}
/// @author huangyuhui
@JsonSerializable
public record CurseManifestMinecraft(@SerializedName("version") String gameVersion,
@SerializedName("modLoaders") @Unmodifiable List<CurseManifestModLoader> modLoaders) implements Validation {
public CurseManifestMinecraft(String gameVersion, List<CurseManifestModLoader> modLoaders) {
this.gameVersion = gameVersion;
this.modLoaders = new ArrayList<>(modLoaders);
this.modLoaders = Collections.unmodifiableList(new ArrayList<>(modLoaders)); // TODO: Is the modLoaders nullable?
}
public String getGameVersion() {
return gameVersion;
}
public List<CurseManifestModLoader> getModLoaders() {
@Override
public List<CurseManifestModLoader> modLoaders() {
return Collections.unmodifiableList(modLoaders);
}
@@ -28,31 +28,12 @@ import org.jackhuang.hmcl.util.gson.Validation;
* @author huangyuhui
*/
@Immutable
public final class CurseManifestModLoader implements Validation {
@SerializedName("id")
private final String id;
@SerializedName("primary")
private final boolean primary;
public record CurseManifestModLoader(@SerializedName("id") String id,
@SerializedName("primary") boolean primary) implements Validation {
public CurseManifestModLoader() {
this("", false);
}
public CurseManifestModLoader(String id, boolean primary) {
this.id = id;
this.primary = primary;
}
public String getId() {
return id;
}
public boolean isPrimary() {
return primary;
}
@Override
public void validate() throws JsonParseException {
if (StringUtils.isBlank(id))
@@ -66,7 +66,7 @@ public final class CurseModpackProvider implements ModpackProvider {
} catch (Throwable ignored) {
}
return new Modpack(manifest.getName(), manifest.getAuthor(), manifest.getVersion(), manifest.getMinecraft().getGameVersion(), description, encoding, manifest) {
return new Modpack(manifest.name(), manifest.author(), manifest.version(), manifest.minecraft().gameVersion(), description, encoding, manifest) {
@Override
public Task<?> getInstallTask(DefaultDependencyManager dependencyManager, Path zipFile, String name, String iconUrl) {
return new CurseInstallTask(dependencyManager, zipFile, this, manifest, name);
@@ -143,6 +143,7 @@ public class McbbsModpackExportTask extends Task<Void> {
.requireAuthlibInjectorServer()
.requireJavaArguments()
.requireLaunchArguments()
.requireOrigins();
.requireOrigins()
.requireAuthor();
}
@@ -34,8 +34,7 @@ public class ModrinthManifest implements ModpackManifest, Validation {
private final int formatVersion;
private final String versionId;
private final String name;
@Nullable
private final String summary;
private final @Nullable String summary;
private final List<File> files;
private final Map<String, String> dependencies;
@@ -96,11 +95,12 @@ public class ModrinthManifest implements ModpackManifest, Validation {
public static class File {
private final String path;
private final Map<String, String> hashes;
@Nullable
private final Map<String, String> env;
private final List<String> downloads;
private final int fileSize;
public File(String path, Map<String, String> hashes, Map<String, String> env, List<String> downloads, int fileSize) {
public File(String path, Map<String, String> hashes, @Nullable Map<String, String> env, List<String> downloads, int fileSize) {
this.path = path;
this.hashes = hashes;
this.env = env;
@@ -116,6 +116,7 @@ public class ModrinthManifest implements ModpackManifest, Validation {
return hashes;
}
@Nullable
public Map<String, String> getEnv() {
return env;
}
@@ -133,7 +134,7 @@ public class ModrinthManifest implements ModpackManifest, Validation {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
File file = (File) o;
return fileSize == file.fileSize && path.equals(file.path) && hashes.equals(file.hashes) && env.equals(file.env) && downloads.equals(file.downloads);
return fileSize == file.fileSize && path.equals(file.path) && hashes.equals(file.hashes) && Objects.equals(this.env, file.env) && downloads.equals(file.downloads);
}
@Override
@@ -37,6 +37,7 @@ import org.jetbrains.annotations.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.time.Instant;
@@ -54,6 +55,7 @@ import java.util.stream.Stream;
import static org.jackhuang.hmcl.util.Lang.mapOf;
import static org.jackhuang.hmcl.util.Pair.pair;
import static org.jackhuang.hmcl.util.gson.JsonUtils.listTypeOf;
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
public final class ModrinthRemoteModRepository implements RemoteModRepository {
public static final ModrinthRemoteModRepository MODS = new ModrinthRemoteModRepository("mod");
@@ -112,9 +114,30 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
pair("limit", Integer.toString(pageSize)),
pair("index", convertSortType(sort))
);
Response<ProjectSearchResult> response = HttpRequest.GET(downloadProvider.injectURL(NetworkUtils.withQuery(PREFIX + "/v2/search", query)))
.getJson(Response.typeOf(ProjectSearchResult.class));
return new SearchResult(response.getHits().stream().map(ProjectSearchResult::toMod), (int) Math.ceil((double) response.totalHits / pageSize));
List<URI> candidates = downloadProvider.injectURLWithCandidates(NetworkUtils.withQuery(PREFIX + "/v2/search", query));
IOException exception = null;
for (URI candidate : candidates) {
try {
LOG.info("Fetching " + candidate);
Response<ProjectSearchResult> response = HttpRequest.GET(candidate.toString())
.getJson(Response.typeOf(ProjectSearchResult.class));
return new SearchResult(response.getHits().stream().map(ProjectSearchResult::toMod), (int) Math.ceil((double) response.totalHits / pageSize));
} catch (IOException e) {
LOG.warning("Failed to search addons: " + candidate, e);
if (candidates.size() == 1) {
exception = e;
} else {
if (exception == null) {
exception = new IOException("Failed to search addons");
}
exception.addSuppressed(e);
}
}
}
throw exception != null ? exception : new IOException("No candidates found");
} finally {
SEMAPHORE.release();
}
@@ -103,5 +103,7 @@ public class MultiMCModpackExportTask extends Task<Void> {
}
}
public static final ModpackExportInfo.Options OPTION = new ModpackExportInfo.Options().requireMinMemory();
public static final ModpackExportInfo.Options OPTION = new ModpackExportInfo.Options()
.requireAuthor()
.requireMinMemory();
}
@@ -107,5 +107,6 @@ public class ServerModpackExportTask extends Task<Void> {
}
public static final ModpackExportInfo.Options OPTION = new ModpackExportInfo.Options()
.requireAuthor()
.requireFileApi(false);
}
@@ -296,6 +296,11 @@ public abstract class FetchTask<T> extends Task<T> {
exceptions.add(ex);
LOG.warning("Failed to download " + uri + ", repeat times: " + retryTime + (redirects == null ? "" : ", redirects: " + redirects), ex);
if (retryTime < retryLimit - 1) {
// Wait for a while before retrying
Thread.sleep(200);
}
}
}
@@ -7,6 +7,13 @@
"time": "2025-12-09T12:43:15+00:00",
"releaseTime": "2025-12-09T12:43:15+00:00"
},
{
"id": "1.21.11-rc3_unobfuscated",
"type": "unobfuscated",
"url": "https://piston-meta.mojang.com/v1/packages/ce3f7ac6d0e9d23ea4e5f0354b91ff15039d9931/1.21.11-rc3_unobfuscated.json",
"time": "2025-12-08T13:59:34+00:00",
"releaseTime": "2025-12-08T13:59:34+00:00"
},
{
"id": "1.21.11-rc2_unobfuscated",
"type": "unobfuscated",
@@ -891,5 +891,7 @@
1.21.11-rc1_unobfuscated
1.21.11-rc2
1.21.11-rc2_unobfuscated
1.21.11-rc3
1.21.11-rc3_unobfuscated
1.21.11
1.21.11_unobfuscated
-1
View File
@@ -6,7 +6,6 @@ pipeline {
VERSION_TYPE = 'dev'
MICROSOFT_AUTH_ID = credentials('microsoft_auth_id')
MICROSOFT_AUTH_SECRET = credentials('microsoft_auth_secret')
CURSEFORGE_API_KEY = credentials('curseforge_api_key')
HMCL_SIGNATURE_KEY = credentials('hmcl_signature_key')
}
-1
View File
@@ -6,7 +6,6 @@ pipeline {
VERSION_TYPE = 'stable'
MICROSOFT_AUTH_ID = credentials('microsoft_auth_id')
MICROSOFT_AUTH_SECRET = credentials('microsoft_auth_secret')
CURSEFORGE_API_KEY = credentials('curseforge_api_key')
HMCL_SIGNATURE_KEY = credentials('hmcl_signature_key')
}
-1
View File
@@ -100,7 +100,6 @@ These options can be specified via environment variables or JVM parameters. If b
| | `-Dhmcl.openjfx.repo=<maven repository url>` | Adds a custom Maven repository for downloading OpenJFX | | |
| | `-Dhmcl.native.encoding=<encoding>` | Specifies the native encoding | Uses the system's native encoding | |
| | `-Dhmcl.microsoft.auth.id=<App ID>` | Specifies the Microsoft OAuth App ID | Uses the built-in Microsoft OAuth App ID | |
| | `-Dhmcl.microsoft.auth.secret=<App Secret>` | Specifies the Microsoft OAuth App Secret | Uses the built-in Microsoft OAuth App Secret | |
| | `-Dhmcl.curseforge.apikey=<Api Key>` | Specifies the CurseForge API key | Uses the built-in CurseForge API key | |
| | `-Dhmcl.native.backend=<auto/jna/none>` | Specifies the native backend used by HMCL | `auto` | |
| | `-Dhmcl.hardware.fastfetch=<true/false>` | Specifies whether to use fastfetch for hardware detection | `true` | |
-1
View File
@@ -99,7 +99,6 @@ HMCL 提供了一系列调试选项,用于控制启动器的行为。
| | `-Dhmcl.openjfx.repo=<maven repository url>` | 添加用于下载 OpenJFX 的自定义 Maven 仓库 | | |
| | `-Dhmcl.native.encoding=<encoding>` | 指定原生编码 | 使用系统的本机编码 | |
| | `-Dhmcl.microsoft.auth.id=<App ID>` | 指定 Microsoft OAuth App ID | 使用 HMCL 内置的 Microsoft OAuth App ID | |
| | `-Dhmcl.microsoft.auth.secret=<App Secret>` | 指定 Microsoft OAuth App 密钥 | 使用 HMCL 内置的 Microsoft OAuth App 密钥 | |
| | `-Dhmcl.curseforge.apikey=<Api Key>` | 指定 CurseForge API 密钥 | 使用 HMCL 内置的 CurseForge API 密钥 | |
| | `-Dhmcl.native.backend=<auto/jna/none>` | 指定HMCL使用的本机后端 | `auto` |
| | `-Dhmcl.hardware.fastfetch=<true/false>` | 指定是否使用 fastfetch 检测硬件信息 | `true` |
-1
View File
@@ -99,7 +99,6 @@ HMCL 提供了一系列除錯選項,用於控制啟動器的行為。
| | `-Dhmcl.openjfx.repo=<maven repository url>` | 添加用於下載 OpenJFX 的自訂 Maven 倉庫 | | |
| | `-Dhmcl.native.encoding=<encoding>` | 設定原生編碼 | 使用系統的本機編碼 | |
| | `-Dhmcl.microsoft.auth.id=<App ID>` | 設定 Microsoft OAuth App ID | 使用 HMCL 內建的 Microsoft OAuth App ID | |
| | `-Dhmcl.microsoft.auth.secret=<App Secret>` | 設定 Microsoft OAuth App 金鑰 | 使用 HMCL 內建的 Microsoft OAuth App 金鑰 | |
| | `-Dhmcl.curseforge.apikey=<Api Key>` | 設定 CurseForge API 金鑰 | 使用 HMCL 內建的 CurseForge API 金鑰 | |
| | `-Dhmcl.native.backend=<auto/jna/none>` | 設定 HMCL 使用的本機後端 | `auto` |
| | `-Dhmcl.hardware.fastfetch=<true/false>` | 設定是否使用 fastfetch 檢測硬體資訊 | `true` |
+1 -1
View File
@@ -60,7 +60,7 @@ Before contributing, please read the [Contributing Guide](./Contributing.md), wh
## Contributors
Since 2015, more than 110 contributors have participated in HMCL. Thank you for your hard work!
Since 2015, more than 120 contributors have participated in HMCL. Thank you for your hard work!
[![Contributors](https://contrib.rocks/image?repo=HMCL-dev/HMCL)](https://github.com/HMCL-dev/HMCL/graphs/contributors)
+1 -1
View File
@@ -61,7 +61,7 @@ HMCL 乃社群共驅之開源項目,迎諸君獻碼或建言。
## 貢獻者
自乙未年(2015)始,百十余人參與 HMCL,謝其勤勞!
自乙未年(2015)始,百二十余人參與 HMCL,謝其勤勞!
[![Contributors](https://contrib.rocks/image?repo=HMCL-dev/HMCL)](https://github.com/HMCL-dev/HMCL/graphs/contributors)
+1 -1
View File
@@ -60,7 +60,7 @@ HMCL 是一个社区驱动的开源项目,欢迎任何人参与贡献代码或
## 贡献者
自 2015 年以来,HMCL 已经有超过 110 位贡献者参与其中,感谢他们的辛勤付出!
自 2015 年以来,HMCL 已经有超过 120 位贡献者参与其中,感谢他们的辛勤付出!
[![Contributors](https://contrib.rocks/image?repo=HMCL-dev/HMCL)](https://github.com/HMCL-dev/HMCL/graphs/contributors)
+1 -1
View File
@@ -60,7 +60,7 @@ HMCL 是一個由社群驅動的開源專案,歡迎任何人參與貢獻程式
## 貢獻者
自 2015 年以來,HMCL 已經有超過 110 位貢獻者參與其中,感謝他們的辛勤付出!
自 2015 年以來,HMCL 已經有超過 120 位貢獻者參與其中,感謝他們的辛勤付出!
[![Contributors](https://contrib.rocks/image?repo=HMCL-dev/HMCL)](https://github.com/HMCL-dev/HMCL/graphs/contributors)
+1 -1
View File
@@ -1,6 +1,6 @@
[versions]
hmclauncher = "3.7.0.1"
jetbrains-annotations = "26.0.1"
jetbrains-annotations = "26.1.0"
kala-compress = "1.27.1-1"
simple-png-javafx = "0.3.0"
gson = "2.13.2"
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=120000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME