Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c0ca7c731 | ||
|
|
0d591a5429 | ||
|
|
900d7595d5 | ||
|
|
5e18c0aad4 | ||
|
|
f51f982f80 | ||
|
|
7c5430424f | ||
|
|
5909c73c48 | ||
|
|
3166c1d405 | ||
|
|
27c73b4434 | ||
|
|
705f978c43 | ||
|
|
67432bf614 | ||
|
|
378c06656d | ||
|
|
e2d6904269 | ||
|
|
8ef2f8be1b | ||
|
|
584f0f39bc | ||
|
|
6529a3bb03 | ||
|
|
0e6f43ccba | ||
|
|
94b10a8b29 | ||
|
|
dc60af6d96 | ||
|
|
272c5d1b57 | ||
|
|
5bfe945fd0 | ||
|
|
3e8a295cf2 | ||
|
|
0d717b84c4 | ||
|
|
13672a57ff | ||
|
|
b19151a811 | ||
|
|
c7d9bc696a | ||
|
|
f426ea48fa | ||
|
|
8b9eeb68f7 | ||
|
|
413069d334 | ||
|
|
bab81da466 | ||
|
|
1138d063d2 | ||
|
|
041eedb765 | ||
|
|
48046cd416 | ||
|
|
9372c0903c | ||
|
|
ee79c50dea |
No files matched your search
@@ -42,11 +42,11 @@ public final class JFXDepthManager {
|
||||
|
||||
private static final DropShadow[] depth = new DropShadow[] {
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.TRANSPARENT, 0, 0, 0, 0),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.12), 4, 0, 0, 1),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.16), 6, 0, 0, 2),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.20), 10, 0, 0, 3),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.24), 14, 0, 0, 4),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.28), 20, 0, 0, 6)
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.12), 4, 0, 0, 0),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.16), 8, 0, 0, 4),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.20), 12, 0, 0, 4),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.24), 16, 0, 0, 4),
|
||||
new DropShadow(BlurType.GAUSSIAN, Color.rgb(0, 0, 0, 0.28), 20, 0, 0, 8)
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -309,6 +309,9 @@ public class JFXCustomColorPickerDialog extends StackPane {
|
||||
|
||||
public void setCurrentColor(Color currentColor) {
|
||||
this.currentColorProperty.set(currentColor);
|
||||
if (curvedColorPicker != null && currentColor != null) {
|
||||
curvedColorPicker.setColor(currentColor);
|
||||
}
|
||||
}
|
||||
|
||||
Color getCurrentColor() {
|
||||
|
||||
@@ -222,6 +222,21 @@ public final class Config extends ObservableSetting {
|
||||
this.acceptPreviewUpdate.set(acceptPreviewUpdate);
|
||||
}
|
||||
|
||||
@SerializedName("disableAutoShowUpdateDialog")
|
||||
private final BooleanProperty disableAutoShowUpdateDialog = new SimpleBooleanProperty(false);
|
||||
|
||||
public BooleanProperty disableAutoShowUpdateDialogProperty() {
|
||||
return disableAutoShowUpdateDialog;
|
||||
}
|
||||
|
||||
public boolean isDisableAutoShowUpdateDialog() {
|
||||
return disableAutoShowUpdateDialog.get();
|
||||
}
|
||||
|
||||
public void setDisableAutoShowUpdateDialog(boolean disableAutoShowUpdateDialog) {
|
||||
this.disableAutoShowUpdateDialog.set(disableAutoShowUpdateDialog);
|
||||
}
|
||||
|
||||
@SerializedName("shownTips")
|
||||
private final ObservableMap<String, Object> shownTips = FXCollections.observableHashMap();
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -66,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;
|
||||
@@ -1288,6 +1290,23 @@ public final class FXUtils {
|
||||
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);
|
||||
|
||||
@@ -411,11 +411,12 @@ public final class LogWindow extends Stage {
|
||||
terminateButton.setOnAction(e -> getSkinnable().onTerminateGame());
|
||||
|
||||
SpinnerPane exportDumpPane = new SpinnerPane();
|
||||
exportDumpPane.getStyleClass().add("small-spinner-pane");
|
||||
JFXButton exportDumpButton = new JFXButton(i18n("logwindow.export_dump"));
|
||||
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);
|
||||
|
||||
@@ -173,7 +173,7 @@ public final class AccountListItemSkin extends SkinBase<AccountListItem> {
|
||||
spinnerCopyUUID.setContent(btnCopyUUID);
|
||||
right.getChildren().add(spinnerCopyUUID);
|
||||
|
||||
JFXButton btnRemove = FXUtils.newToggleButton4(SVG.DELETE);
|
||||
JFXButton btnRemove = FXUtils.newToggleButton4(SVG.DELETE_FOREVER);
|
||||
btnRemove.setOnAction(e -> Controllers.confirm(i18n("button.remove.confirm"), i18n("button.remove"), skinnable::remove, null));
|
||||
BorderPane.setAlignment(btnRemove, Pos.CENTER);
|
||||
FXUtils.installFastTooltip(btnRemove, i18n("button.delete"));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -57,13 +57,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.jackhuang.hmcl.setting.ConfigHolder.config;
|
||||
import static org.jackhuang.hmcl.ui.FXUtils.newBuiltinImage;
|
||||
import static org.jackhuang.hmcl.ui.FXUtils.onEscPressed;
|
||||
@@ -194,7 +193,10 @@ public class DecoratorController {
|
||||
String backgroundImage = config().getBackgroundImage();
|
||||
if (backgroundImage != null)
|
||||
try {
|
||||
image = tryLoadImage(Paths.get(backgroundImage));
|
||||
Path path = Path.of(backgroundImage);
|
||||
image = Files.isDirectory(path)
|
||||
? randomImageIn(path)
|
||||
: tryLoadImage(path);
|
||||
} catch (Exception e) {
|
||||
LOG.warning("Couldn't load background image", e);
|
||||
}
|
||||
@@ -300,14 +302,14 @@ public class DecoratorController {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Path> candidates;
|
||||
ArrayList<Path> candidates;
|
||||
try (Stream<Path> stream = Files.list(imageDir)) {
|
||||
candidates = stream
|
||||
.filter(it -> FXUtils.IMAGE_EXTENSIONS.contains(getExtension(it).toLowerCase(Locale.ROOT)))
|
||||
.filter(Files::isReadable)
|
||||
.collect(toList());
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
} catch (IOException e) {
|
||||
LOG.warning("Failed to list files in ./bg", e);
|
||||
LOG.warning("Failed to list files in " + imageDir, e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,14 +124,14 @@ public class InstallersPage extends AbstractInstallersPage {
|
||||
|
||||
if (libraryType != null) {
|
||||
String loaderName = switch (libraryType) {
|
||||
case FORGE -> "forge";
|
||||
case NEO_FORGE -> "neoforge";
|
||||
case CLEANROOM -> "cleanroom";
|
||||
case LEGACY_FABRIC -> "legacy_fabric";
|
||||
case FABRIC -> "fabric";
|
||||
case LITELOADER -> "liteloader";
|
||||
case QUILT -> "quilt";
|
||||
case OPTIFINE -> "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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -144,8 +144,6 @@ public final class ModpackSelectionPage extends VBox implements WizardPage {
|
||||
// otherwise we still consider the file as modpack zip file
|
||||
// since casually the url may not ends with ".zip"
|
||||
Path modpack = Files.createTempFile("modpack", ".zip");
|
||||
handler.resolve();
|
||||
|
||||
Controllers.taskDialog(
|
||||
new FileDownloadTask(url, modpack)
|
||||
.whenComplete(Schedulers.javafx(), e -> {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -164,7 +164,7 @@ public final class JavaRestorePage extends ListPageBase<JavaRestorePage.Disabled
|
||||
if (skinnable.realPath == null) {
|
||||
revealButton.setDisable(true);
|
||||
|
||||
JFXButton removeButton = FXUtils.newToggleButton4(SVG.DELETE);
|
||||
JFXButton removeButton = FXUtils.newToggleButton4(SVG.DELETE_FOREVER);
|
||||
removeButton.setOnAction(e -> skinnable.onRemove());
|
||||
FXUtils.installFastTooltip(removeButton, i18n("java.disabled.management.remove"));
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -277,7 +277,9 @@ public final class MainPage extends StackPane implements DecoratorPage {
|
||||
private void showUpdate(boolean show) {
|
||||
doAnimation(show);
|
||||
|
||||
if (show && getLatestVersion() != null && !Objects.equals(config().getPromptedVersion(), getLatestVersion().getVersion())) {
|
||||
if (show && !config().isDisableAutoShowUpdateDialog()
|
||||
&& getLatestVersion() != null
|
||||
&& !Objects.equals(config().getPromptedVersion(), getLatestVersion().getVersion())) {
|
||||
Controllers.dialog(new MessageDialogPane.Builder("", i18n("update.bubble.title", getLatestVersion().getVersion()), MessageDialogPane.MessageType.INFO)
|
||||
.addAction(i18n("button.view"), () -> {
|
||||
config().setPromptedVersion(getLatestVersion().getVersion());
|
||||
|
||||
@@ -216,6 +216,14 @@ public final class SettingsPage extends ScrollPane {
|
||||
settingsPane.getContent().add(previewPane);
|
||||
}
|
||||
|
||||
{
|
||||
LineToggleButton disableAutoShowUpdateDialogPane = new LineToggleButton();
|
||||
disableAutoShowUpdateDialogPane.setTitle(i18n("update.disable_auto_show_update_dialog"));
|
||||
disableAutoShowUpdateDialogPane.setSubtitle(i18n("update.disable_auto_show_update_dialog.subtitle"));
|
||||
disableAutoShowUpdateDialogPane.selectedProperty().bindBidirectional(config().disableAutoShowUpdateDialogProperty());
|
||||
settingsPane.getContent().add(disableAutoShowUpdateDialogPane);
|
||||
}
|
||||
|
||||
{
|
||||
MultiFileItem<EnumCommonDirectory> fileCommonLocation = new MultiFileItem<>();
|
||||
fileCommonLocation.loadChildren(Arrays.asList(
|
||||
|
||||
@@ -110,7 +110,7 @@ final class DatapackListPageSkin extends SkinBase<DatapackListPage> {
|
||||
createToolbarButton2(i18n("search"), SVG.SEARCH, () -> isSearching.set(true))
|
||||
);
|
||||
|
||||
JFXButton removeButton = createToolbarButton2(i18n("button.remove"), SVG.DELETE, () -> {
|
||||
JFXButton removeButton = createToolbarButton2(i18n("button.remove"), SVG.DELETE_FOREVER, () -> {
|
||||
Controllers.confirm(i18n("button.remove.confirm"), i18n("button.remove"), () -> {
|
||||
skinnable.removeSelected(listView.getSelectionModel().getSelectedItems());
|
||||
}, null);
|
||||
|
||||
@@ -252,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();
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -154,7 +154,7 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
|
||||
|
||||
// Toolbar Selecting
|
||||
toolbarSelecting.getChildren().setAll(
|
||||
createToolbarButton2(i18n("button.remove"), SVG.DELETE, () -> {
|
||||
createToolbarButton2(i18n("button.remove"), SVG.DELETE_FOREVER, () -> {
|
||||
Controllers.confirm(i18n("button.remove.confirm"), i18n("button.remove"), () -> {
|
||||
skinnable.removeSelected(listView.getSelectionModel().getSelectedItems());
|
||||
}, null);
|
||||
|
||||
@@ -259,7 +259,7 @@ public final class WorldBackupsPage extends ListPageBase<WorldBackupsPage.Backup
|
||||
FXUtils.installFastTooltip(btnReveal, i18n("reveal.in_file_manager"));
|
||||
btnReveal.setOnAction(event -> skinnable.onReveal());
|
||||
|
||||
JFXButton btnDelete = FXUtils.newToggleButton4(SVG.DELETE);
|
||||
JFXButton btnDelete = FXUtils.newToggleButton4(SVG.DELETE_FOREVER);
|
||||
right.getChildren().add(btnDelete);
|
||||
FXUtils.installFastTooltip(btnDelete, i18n("world.backup.delete"));
|
||||
btnDelete.setOnAction(event -> Controllers.confirm(i18n("button.remove.confirm"), i18n("button.remove"), skinnable::onDelete, null));
|
||||
|
||||
@@ -35,8 +35,6 @@ 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;
|
||||
@@ -66,7 +64,8 @@ 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;
|
||||
|
||||
private final ImageContainer iconImageView = new ImageContainer(32);
|
||||
|
||||
@@ -76,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);
|
||||
@@ -205,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());
|
||||
@@ -248,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);
|
||||
}
|
||||
@@ -285,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(
|
||||
@@ -296,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();
|
||||
@@ -343,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) {
|
||||
@@ -358,7 +385,7 @@ public final class WorldInfoPage extends SpinnerPane implements WorldManagePage.
|
||||
playerGameTypeTag.setValue(newValue.ordinal());
|
||||
hardcoreTag.setValue((byte) 0);
|
||||
}
|
||||
saveLevelDat();
|
||||
saveWorldData();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -428,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 {
|
||||
@@ -451,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);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -472,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);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -484,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) {
|
||||
@@ -588,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));
|
||||
@@ -653,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,7 +382,7 @@ public final class WorldListPage extends ListPageBase<World> implements VersionP
|
||||
IconedMenuItem exportMenuItem = new IconedMenuItem(SVG.OUTPUT, i18n("world.export"), () -> page.export(world), popup);
|
||||
exportMenuItem.setDisable(worldLocked);
|
||||
|
||||
IconedMenuItem deleteMenuItem = new IconedMenuItem(SVG.DELETE, i18n("world.delete"), () -> page.delete(world), popup);
|
||||
IconedMenuItem deleteMenuItem = new IconedMenuItem(SVG.DELETE_FOREVER, i18n("world.delete"), () -> page.delete(world), popup);
|
||||
deleteMenuItem.setDisable(worldLocked);
|
||||
|
||||
IconedMenuItem duplicateMenuItem = new IconedMenuItem(SVG.CONTENT_COPY, i18n("world.duplicate"), () -> page.copy(world), popup);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ public final class WorldManagePage extends DecoratorAnimatedPage implements Deco
|
||||
|
||||
managePopupMenu.getContent().addAll(
|
||||
new IconedMenuItem(SVG.OUTPUT, i18n("world.export"), () -> WorldManageUIUtils.export(getSkinnable().world, getSkinnable().sessionLockChannel), managePopup),
|
||||
new IconedMenuItem(SVG.DELETE, i18n("world.delete"), () -> WorldManageUIUtils.delete(getSkinnable().world, () -> getSkinnable().fireEvent(new PageCloseEvent()), getSkinnable().sessionLockChannel), managePopup),
|
||||
new IconedMenuItem(SVG.DELETE_FOREVER, i18n("world.delete"), () -> WorldManageUIUtils.delete(getSkinnable().world, () -> getSkinnable().fireEvent(new PageCloseEvent()), getSkinnable().sessionLockChannel), managePopup),
|
||||
new IconedMenuItem(SVG.CONTENT_COPY, i18n("world.duplicate"), () -> WorldManageUIUtils.copyWorld(getSkinnable().world, null), managePopup)
|
||||
);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -31,7 +31,7 @@
|
||||
},
|
||||
{
|
||||
"title" : "jsoup",
|
||||
"subtitle" : "Copyright © 2009 - 2024 Jonathan Hedley (https://jsoup.org/)\nLicensed under the MIT License.",
|
||||
"subtitle" : "Copyright © 2009 - 2025 Jonathan Hedley (https://jsoup.org/)\nLicensed under the MIT License.",
|
||||
"externalLink" : "https://jsoup.org/"
|
||||
},
|
||||
{
|
||||
@@ -66,17 +66,17 @@
|
||||
},
|
||||
{
|
||||
"title" : "Java Animated PNG",
|
||||
"subtitle" : "Copyright (C) 2015 Andrew Ellerton.\nLicensed under the Apache 2.0 License.",
|
||||
"subtitle" : "Copyright © 2015 Andrew Ellerton.\nLicensed under the Apache 2.0 License.",
|
||||
"externalLink" : "https://github.com/aellerton/japng"
|
||||
},
|
||||
{
|
||||
"title": "Terracotta",
|
||||
"subtitle": "Copyright (C) 2025 Burning_TNT.\nAll rights reserved.",
|
||||
"subtitle": "Copyright © 2025 Burning_TNT.\nLicensed under the AGPL 3.0 License.",
|
||||
"externalLink": "https://github.com/burningtnt/Terracotta"
|
||||
},
|
||||
{
|
||||
"title": "EasyTier",
|
||||
"subtitle": "Copyright 2024-present Easytier Programme within The Commons Conservancy.\nLicensed under the LGPL 3.0 License.",
|
||||
"subtitle": "Copyright © 2024-present Easytier Programme within The Commons Conservancy.\nLicensed under the LGPL 3.0 License.",
|
||||
"externalLink": "https://github.com/EasyTier/EasyTier"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
@@ -1587,6 +1587,8 @@ update.channel.nightly.hint=You are currently using a Nightly channel build of t
|
||||
update.channel.nightly.title=Nightly Channel Notice
|
||||
update.channel.stable=Release
|
||||
update.checking=Checking for updates
|
||||
update.disable_auto_show_update_dialog=Do not show update dialog automatically
|
||||
update.disable_auto_show_update_dialog.subtitle=Enable this option to prevent HMCL from automatically showing the update dialog.
|
||||
update.failed=Failed to update
|
||||
update.found=Update Available!
|
||||
update.newest_version=Latest version: %s
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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如果遇到問題,你可以點擊右上角幫助按鈕進行求助。
|
||||
@@ -1368,6 +1368,8 @@ update.channel.nightly.hint=你正在使用 HMCL 預覽版。預覽版更新較
|
||||
update.channel.nightly.title=預覽版提示
|
||||
update.channel.stable=穩定版
|
||||
update.checking=正在檢查更新
|
||||
update.disable_auto_show_update_dialog=不自動顯示更新彈窗
|
||||
update.disable_auto_show_update_dialog.subtitle=啟用此選項,HMCL 將不會自動彈出更新彈窗。
|
||||
update.failed=更新失敗
|
||||
update.found=發現到更新
|
||||
update.newest_version=最新版本為:%s
|
||||
|
||||
@@ -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\
|
||||
如遇到问题,你可以点击右上角帮助按钮进行求助。
|
||||
@@ -1373,6 +1373,8 @@ update.channel.nightly.hint=你正在使用 HMCL 预览版。预览版更新较
|
||||
update.channel.nightly.title=预览版提示
|
||||
update.channel.stable=稳定版
|
||||
update.checking=正在检查更新
|
||||
update.disable_auto_show_update_dialog=不自动显示更新弹窗
|
||||
update.disable_auto_show_update_dialog.subtitle=启用此选项,HMCL 将不会自动弹出更新弹窗。
|
||||
update.failed=更新失败
|
||||
update.found=发现更新
|
||||
update.newest_version=最新版本为:%s
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -354,7 +354,7 @@ all-the-mods-expert-remastered;355;;All The Mods Expert: Remastered;;
|
||||
all-the-mods-0;356;;All the Mods 0;;ATM0
|
||||
all-the-mods-fabric;357;;All the Mods Fabric;;ATMF
|
||||
the-pixelmon-modpack;358;;The Pixelmon Modpack;;
|
||||
better-mc-skyblock;359;;更好的我的世界空岛;Better MC Skyblock;BMCS
|
||||
better-mc-skyblock;359;;更好的我的世界空岛;Better Minecraft Skyblock;BMCS
|
||||
age-of-fate;360;;命运时代;Age of Fate;AOF
|
||||
minecraft-kingdoms;361;;MC Kingdoms;;
|
||||
;362;;幻想旅程;Imaginary Journey;
|
||||
@@ -364,7 +364,7 @@ valhelsia-4;365;;Valhelsia 4;;
|
||||
another-quality-modpack-3;366;;Another Quality Modpack 3;;
|
||||
nomifactory;367;;Nomifactory;;
|
||||
allusiveness;368;;Allusiveness;;
|
||||
the-way-of-reincarnation;370;;转生之路;The way of reincarnation;
|
||||
the-way-of-reincarnation;370;;转生之路;The Way of Reincarnation;
|
||||
sky-friends;371;;Sky Friends;;
|
||||
magic-pouch;372;;魔法包裹;Magic Pouch;
|
||||
magica-infinitum-iii;373;;Magica Infinitum III;;
|
||||
@@ -392,7 +392,7 @@ create-yourself;395;;Create Yourself;;
|
||||
starrynight-pray-stp;397;;星夜祈临;StarryNight Pray;StP
|
||||
rustic-waters-ii;398;;乡村水域2;Rustic Waters II;
|
||||
enigmatica6expert;399;;Enigmatica 6: Expert;;E6E
|
||||
celestial-journey;400;;Celestial Journey;;
|
||||
celestial-journey;400;;星空之旅;Celestial Journey;
|
||||
;401;;天空舞台;Skyblock Create Show;
|
||||
project-architect;402;;Project Architect;;
|
||||
greed-the-resource-3-factory;403;;Greed the Resource 3: Factory;;
|
||||
@@ -509,7 +509,7 @@ mechanical-mastery;516;;Mechanical Mastery;;MM
|
||||
escape-from-2020;517;;逃离2020;Escape From 2020;
|
||||
lunaria-expert;518;;Lunaria Expert;;
|
||||
nomi-ceu;519;;Nomifactory CEu;;Nomi-CEu
|
||||
;520;;乐事 · 起源;Delight · Origins;DO
|
||||
;520;;乐事 · 起源;Delight · Origins;DO
|
||||
tankoptimization;521;;坦坦优化;Tankoptimization;
|
||||
;522;;InfinityCraft;;IC
|
||||
pick-the-stars;523;;摘星;Pick The Stars;PTS
|
||||
@@ -612,7 +612,7 @@ eternal-night-modpacks;622;;永夜;Eternal Night;ETN
|
||||
all-the-mods-9;623;;All the Mods 9;;ATM9
|
||||
spoornpack;624;;Spoornpack;;
|
||||
;625;;起源RPG;;ORPG
|
||||
;626;;织彩钓月;Oriun Tagayasu;OTSU
|
||||
aruori;626;;织彩钓月;Aruori;
|
||||
;627;;冰河物语;;
|
||||
hommage;628;;Hommage;;
|
||||
days-to-craft;629;;Seven Days To Craft;;
|
||||
@@ -650,7 +650,7 @@ valhelsia-6;660;;Valhelsia 6;;
|
||||
all-the-mods-volcanoblock;661;;All the Mods: Volcano Block;;ATMVB
|
||||
gregtronix-revoluton;662;;Gregtronix Revolution;;GR
|
||||
;663;;空岛物语;Empty Island RPG;EIRPG
|
||||
prominence-fabric;664;;卓越1 [FABRIC];Prominence I;
|
||||
prominence-1-rpg;664;;卓越 I;Prominence I;
|
||||
multiskyblock-2;665;;模块化空岛2;MultiSkyBlock 2;MSB2
|
||||
;666;;The Minehattan Project;;
|
||||
;667;;万象天工;Millions of Heavens industries;MOHI
|
||||
@@ -701,7 +701,7 @@ create-perfect-world;711;;Create: Perfect World;;
|
||||
new-simple-mods;712;;New Simple Mods - Easy to Understand;;
|
||||
;713;;灾变录;Catastrophe Record;CR
|
||||
sky-greg;714;;Sky Greg;;
|
||||
deceasedcraft;715;;亡者世界;Deceased Craft;
|
||||
deceasedcraft;715;;亡者世界;DeceasedCraft - Urban Zombie Apocalypse;
|
||||
;716;;生欲:求生;Vivere The Zombie Apocalypse;VZA
|
||||
create-planetary;717;;Create Planetary;;
|
||||
master-mabaoguo;718;;Master mabaoguo;;
|
||||
@@ -754,7 +754,7 @@ modecube;765;;ModéCube;;
|
||||
electrictechnocraft;766;;ElectricTechnoCraft;;
|
||||
create-2-mekanism;767;;Create 2 Mekanism;;C2M
|
||||
randblock;768;;随机空岛;RandBlock;RD
|
||||
;769;;格雷科技休闲版;GregTech Leisure;GTL
|
||||
;769;;格雷科技休闲版;GregTech Leisure;GTL
|
||||
frozenopolis;770;;Frozenopolis;;
|
||||
infernal-rpg;771;;Infernal Origins;;
|
||||
;772;;天狼星;Sirius;
|
||||
@@ -866,9 +866,9 @@ create-vanilla-exploration;879;;Vanilla Create Exploration;;
|
||||
progress;880;;Progress: Create;;
|
||||
aeon-automata;881;;Aeon Automata;;AA
|
||||
;882;;被恐惧支配2:收容失效;Dominated by Fear 2 Containment Breach;DoF2
|
||||
;883;;剑拔弩张之时;;TC
|
||||
tensioncraft;883;;剑拔弩张之时;;TC
|
||||
project-architect-2;884;;Project Architect 2;;
|
||||
;885;;路网通途 / 接入铁路网络;Railway Network Access;RNA
|
||||
;885;;接入铁路网络:我的世界铁路;MTR Railway Network Access;RNA-MTR
|
||||
create-mekanized;886;;Create: Mekanized;;
|
||||
create-perfect-world-2;887;;Create: Perfect World 2;;
|
||||
create-stellar;888;;Create Stellar;;
|
||||
@@ -923,7 +923,7 @@ setgamedifficulty-reika;936;;SetGameDifficulty Reika;;
|
||||
epic-journey-gtceu;937;;Epic Journey GTCEu;;
|
||||
terrafirmacraft-leap-the-top;938;;飞渡群峦;TerraFirmaCraft:Leap The Top;TFC:LTT
|
||||
gregtech-skybound;939;;Gregtech: Skybound;;
|
||||
simple-tfc;940;;简单群峦;SimpleTFC;
|
||||
simple-tfc;940;;简单群峦;Simple TFC;
|
||||
ftb-presents-direwolf20-s14;941;;FTB Presents Direwolf20 1.21;;
|
||||
final-judgment-save-the-world;942;;Final Judgment:Save the world;;
|
||||
;943;;极端世界:重置;Extreme World Reset;EWR
|
||||
@@ -998,10 +998,10 @@ ashes-to-ashes;1012;;尘归尘;Ashes To Ashes;ATA
|
||||
create-silence-and-prosperity;1014;;机械动力:寂静与繁荣;Create Silence and Prosperity;CSP
|
||||
mif;1015;;MI:Foundation;;MIF
|
||||
c2mse2;1016;;Create 2 Mekanism: Sky Edition 2;;C2MSE2
|
||||
;1017;;耕云钓月;Kumo O Tagayasu;KOTS
|
||||
kumo-o-tagayasu;1017;;耕云钓月;Kumo O Tagayasu;KOTS
|
||||
;1018;;无限战争4;Infinity War4;INF4
|
||||
;1019;;群峦传说:工业长路;;
|
||||
;1020;;自然冒险 新生;Nature Adventure Newborn;NAB
|
||||
;1020;;自然冒险 新生;Nature Adventure Newborn;NAB
|
||||
hmbo;1021;;羽舲的基础优化;Hanekmio's Basis Optimization;
|
||||
create-star-valley;1022;;Create: Gears of History;;
|
||||
;1023;;阿尔法计划;AlphaPlan;AP
|
||||
@@ -1026,7 +1026,7 @@ compression;1041;;Compression;;
|
||||
compact-sky-easy;1042;;Compact Sky: Easy;;CSE
|
||||
;1043;;丰收与探索;Harvest and Exploration;
|
||||
;1044;;脆骨症:黯光;No Flesh Within Chest-DIM;NFWC-DIM
|
||||
;1045;;小雷的优化冒险;;
|
||||
;1045;;光陆冒险;;
|
||||
cobblemon-eternal-edition;1046;;Cobblemon Eternal;;
|
||||
;1047;;Tinkerer's Quilt;;
|
||||
gregtech-expert;1048;;GregTech Expert;;
|
||||
@@ -1044,7 +1044,7 @@ ftb-oceanblock-2;1059;;FTB OceanBlock 2;;
|
||||
;1060;;伊甸空天2;Eden Aerospace 2;EAS2
|
||||
create-infinity-mechanism;1061;;机械动力:无限构件;Create:Infinity Mechanism;CIM
|
||||
beyond-depth;1062;;Beyond Depth;;
|
||||
;1063;;枪械交界地;TACZ Amid Crucible Zone;
|
||||
;1063;;枪械交界地-旧地狱篇;;
|
||||
;1064;;真幻世界;Realfantacy World;R.F.
|
||||
minenufactory;1065;;创世工厂;Minenufactory;MF
|
||||
craft-to-exile-2;1066;;放逐之路2;Craft to Exile 2 (VR Support);CTE2
|
||||
@@ -1058,7 +1058,7 @@ sky1234;1074;;sky1234;;
|
||||
star-technology;1075;;Star Technology;;
|
||||
;1076;;Hyper World;;HW
|
||||
;1077;;妖月的魔法金属整合包;yaoyaoDream's ManaMetalMod Modpack;YMM
|
||||
techcraft-severwinter;1078;;科技工艺:严冬;TechCraft: SevereWinter;TCSW
|
||||
forgottenwinter;1078;;遗忘严冬;ForgottenWinter;FTW
|
||||
randblock2-winterize;1079;;随机空岛 2:银装素裹;RandBlock2:Winterize;
|
||||
create-the-brass-concerto;1080;;机械动力:黄铜协奏曲;Create: The Brass Concerto;CBC
|
||||
explorers-eve;1081;;Explorer's Eve;;
|
||||
@@ -1071,7 +1071,6 @@ mierno;1087;;迷厄路;Mierno;
|
||||
;1088;;最后那些天;Those last day;
|
||||
;1089;;泠月狐基础整合;LunarFox;
|
||||
roguelike-adventures-and-dungeons-3;1090;;冒险与地牢3;Roguelike Adventures and Dungeons 3;RAD3
|
||||
;1091;;羽舲界;Hanekmio Instance;HMI
|
||||
;1092;;玄理2:洗剪版;EnigTech 2 - Dishwasher's Cut;ET2DC
|
||||
wheelchair-gregtech;1093;;Wheelchair Gregtech;;
|
||||
egged-up;1094;;Egged Up;;
|
||||
@@ -1110,15 +1109,15 @@ skillet-man;1123;;平底锅侠;Skillet Man;
|
||||
create-creative-and-beyond;1127;;机械动力:创造与超越;Create Creative and Beyond;CCB
|
||||
create-delight-remake;1128;;机械动力:齿轮盛宴;Create:Delight Remake;CDR
|
||||
ftb-skies-2;1129;;FTB Skies 2;;
|
||||
;1130;;星辰时代:科技魔法;Stellar Era: Technomagic;SETM
|
||||
;1130;;星熵:灵械;Stellar Era: Technomagic;SETM
|
||||
aircrashed-engineer;1131;;坠机工程师;Aircrashed Engineer;ACE
|
||||
project-tfcreate;1132;;Project: TFCreate;;
|
||||
;1133;;落幕曲;;
|
||||
;1133;;落幕曲;Closing Song;
|
||||
;1134;;超大陆:勇气;Supercontinent:Pluck;SUPL
|
||||
create-chronicles-the-endventure;1135;;Create Chronicles: The Endventure;;
|
||||
life-in-the-village-4;1136;;Life in the village 4;;LITV4
|
||||
real-island-2-modular-craft;1137;;真实空岛2:模块化之旅;Real Island 2 - Modular Craft;RI2
|
||||
;1138;;奥术咖啡馆;;
|
||||
;1138;;奥术咖啡馆;Arcane Cofferia;
|
||||
unyielding;1139;;Unyielding;;
|
||||
;1140;;剑与王国;;SNK
|
||||
the-fungal-infection-coop;1141;;The Fungal Infection | Co-Op Base Defense;;
|
||||
@@ -1140,26 +1139,26 @@ skyrealm-descent;1157;;Skyrealm: Descent;;
|
||||
;1158;;远征:以太利亚;Expedition: Ætheria;
|
||||
;1159;;快速优化;Rapid Optimization;RO
|
||||
liminal-industries;1160;;阈限工业;Liminal Industries;
|
||||
;1161;;史诗冒险;;EA
|
||||
;1161;;史诗冒险;Epic Adventure;EA
|
||||
;1162;;根自日常;ROOTINE;
|
||||
blue-archive-x-mineraft;1163;;我的世界x蔚蓝档案;BlueArchive x Minecraft;BACraft
|
||||
;1164;;Fresh & Smooth;;
|
||||
;1165;;机动重启工程:风之旅;The Caravan of Winds;TCW
|
||||
;1166;;Furry Fandom Club Boss Rush Official Offline;;FFCBR
|
||||
immersive-ultra;1167;;极致沉浸;Immersive Ultra;
|
||||
;1168;;Polymania;;
|
||||
;1168;;Polymania!;;
|
||||
survivearchive;1169;;SurviveArchive - A Blue Archive modpack;;
|
||||
beloong;1170;;化龍;BeLoong;
|
||||
;1171;;畅游自然;;SiF
|
||||
;1172;;退休工艺;Retirement Craft;RmC
|
||||
;1173;;随机枪械乱斗;NimShade's Random Gunfight;NRG
|
||||
;1173;;溯光暗潮:云影;NS's Random Gunfight;NRG
|
||||
;1174;;雪狐的基础整合;SF Integrated Modpack;SFI
|
||||
;1175;;硬核惊变;Hardcore Surprise;HS
|
||||
society-sunlit-valley;1176;;Society: Sunlit Valley;;
|
||||
ciscos-fantasy-medieval-rpg-dragonfyre;1177;;Cisco's Fantasy Medieval RPG [Dragonfyre];;
|
||||
all-the-mods-10-sky;1178;;All the Mods 10: To the Sky;;ATM10S
|
||||
;1179;;谐伴匠途;;
|
||||
;1181;;Turbo Vulkan;;TV
|
||||
;1181;;转变思路优化;New-Path Optimization;NO
|
||||
uls-zsurvival-craft;1182;;Z-Liminex;;
|
||||
;1183;;MITE 重生 3;MITE Reborn 3;MR
|
||||
reclamation-reclaim-the-world;1184;;Reclamation - Reclaim the World!;;
|
||||
@@ -1176,11 +1175,11 @@ realm-of-destiny;1192;;生命之境;Realm of Destiny;ROD
|
||||
pvzw;1195;;植物大战僵尸:世界;Plants VS Zombies : World;PVZW
|
||||
;1196;;农场物语Forge版;FarmingTales Forge;FT-WT
|
||||
new-century-adventure;1197;;新世纪之险;New Century Adventure;NCA
|
||||
repalmon;1198;;Re帕鲁梦;;RPLM
|
||||
repalmon;1198;;Re帕鲁梦;RePalmon;RPLM
|
||||
structural-ingenuity;1199;;结构型奇思妙想;Structural Ingenuity;
|
||||
arcaneaxis-ars;1200;;秘法象限;ArcaneAxis;ARS
|
||||
gregtech-easy;1201;;格雷科技简单版;GregTech Easy;GTE
|
||||
;1202;;Creation Exploring the Road of;;CETR
|
||||
;1202;;机境交响;Creation Exploring the Road of;CETR
|
||||
multiblockful-skies;1203;;Multiblockful Skies;;
|
||||
;1204;;刀剑物语;SwordStory;SS
|
||||
;1205;;无垠征途;The Unbounded Expedition;TUE
|
||||
@@ -1189,7 +1188,7 @@ custom-battleroyale-complete;1207;;完整自定义大逃杀;Custome BattleRoyale
|
||||
paradise-of-lucky-blocks;1208;;Paradise of Lucky Blocks;;
|
||||
;1209;;极致优化;Xavier Optimized;XO
|
||||
;1210;;神秘时代4花园;Thaumcraft IV Sky Islands;
|
||||
;1211;;弥散往生;Diffusion: Soulfare;
|
||||
;1211;;弥散往生;Diffusion: Soulfare;DSF
|
||||
mana-metal-new-horizons;1212;;魔法金屬:新視野;Mana Metal: New Horizons;M3NH
|
||||
farmy-skyblock;1213;;Farmy Skyblock;;
|
||||
bloody-skyblock-modpack;1214;;Bloody Skyblock;;
|
||||
@@ -1219,8 +1218,113 @@ linggango;1237;;Linggango;;
|
||||
create-industrialized-tech;1238;;Create: Industrialized Tech;;
|
||||
;1239;;灵璟铁路都市;LingJing Train City;LJTC
|
||||
erstwhile-journey-2;1240;;往昔之旅2;Erstwhile Journey 2;EJ2
|
||||
;1241;;诡厄:使徒;;
|
||||
;1241;;诡厄:使徒;;GRAE
|
||||
;1242;;时间之书 : 星之旅行-重制版;BookofTime StarTravel;BKSL
|
||||
cook-in-skyland-elegant-feast;1243;;天空厨房:典雅盛宴;Cook in Skyland Elegant Feast;CiS2
|
||||
ftb-stoneblock-4;1244;;FTB Stoneblock 4;;SB4
|
||||
ftb-stoneblock-4;1244;;FTB StoneBlock 4;;SB4
|
||||
techevdiscovery;1245;;TechEv || Discovery;;
|
||||
g3-project;1246;;G3 project;;
|
||||
;1247;;新州;Xin Zhou;XZ
|
||||
emc-and-fe-plus3;1248;;EMC & FE +++;;E&F2
|
||||
terracraft-confluence;1249;;泰拉工艺:汇流;TerraCraft:Confluence;TCC
|
||||
;1250;;探索领域;Explore Realm;ER
|
||||
beyond-cosmo;1251;;Beyond Cosmo;;
|
||||
;1252;;闲居物语;Travel Architecture Dreams;TAD
|
||||
high-altitude-alchemy;1253;;High-Altitude Alchemy;;
|
||||
;1254;;机械动力: 界位工程师;Create Boundary Engineer;CBE
|
||||
skyopolis-evolved;1255;;Skyopolis: Evolved;;
|
||||
;1256;;IFR的1.12.2优化整合包;IFR's Forgified Optimization;IFO
|
||||
;1257;;无穷匠艺;;
|
||||
;1258;;Mersive.;;MS
|
||||
;1259;;GD656极致生电整合包;GD656 Ultimate Redstone;SD
|
||||
;1260;;登神者:天阶咏叹;The God Ascender;TGA
|
||||
;1261;;虚饰作品;Fictional;
|
||||
;1262;;无尽工坊:奇境传说;Infinity Workshop: Legends of Wonderland;IWLoW
|
||||
;1263;;大群方舟;Arknights: The Great Tide;AGT
|
||||
arcadia-rpg;1264;;Arcadia[RPG];;
|
||||
ozone-skyblock-reborn-2;1265;;Ozone Skyblock Reborn 2;;
|
||||
witarcland;1266;;维塔克兰;Witarcland;WTL
|
||||
big-globe-optimized-forge;1267;;Big Globe Optimized;;
|
||||
;1268;;GD656轻量优化打底整合包;GD656 Ultimate Optimized;GDO
|
||||
terra-firma-far-horizons;1269;;群峦传说:野望;Terra Firma Far Horizons;TFFH
|
||||
;1270;;烬蓝物语 2;BlueAsh Things II;BAT2
|
||||
anvilcraft-turbo;1271;;铁砧工艺:极速版;AnvilCraft-Turbo;ANCT
|
||||
jrs-tree-of-life;1272;;生命之树;Tree of life;
|
||||
reimagined-forge;1273;;Reimagined;;
|
||||
;1274;;MTR城市建设;MTR Urban Construction;MUC
|
||||
;1275;;Zecoar 整合包;Zecoar Modpack;ZM
|
||||
create-stranded-at-sea;1276;;Create: Stranded at Sea;;
|
||||
;1277;;胶兽异界之旅;;
|
||||
spellbound-skies;1278;;Spellbound Skies;;
|
||||
cozy-meadows;1279;;Cozy Meadows;;
|
||||
;1280;;无际旅人;EpochRealms;
|
||||
mythcrafts;1281;;MYTHCRAFT 5;;MC
|
||||
;1282;;牧场物语;Harvest Moon;
|
||||
;1283;;逃逸:寄生末日;SRP: Escape Parasite Doom;SRP:epd
|
||||
;1284;;Ice and M;;IAM
|
||||
;1285;;秋水;autumn floods;AF
|
||||
;1286;;V2O5;;
|
||||
;1287;;地牢冒险者;Dungeon Adventurer;DA
|
||||
ultramodern-optimization;1289;;超现代优化;Ultramodern optimization;UO
|
||||
reverie-foundry;1290;;遐想铸造厂;Reverie Foundry;RF
|
||||
;1291;;神秘时代4·全家桶;All the thaumcraft's mod;AllTC
|
||||
over-stars;1292;;Over Stars;;
|
||||
pandemonium-nexus-anarchic-aeon;1293;;万象枢纽:无序纪元;Pandemonium Nexus: Anarchic Aeon;PNAA
|
||||
;1294;;菌染亵渎;Fungal Infection Blasphemy;FIB
|
||||
;1295;;Ice and M:Sky;;IAMS
|
||||
;1296;;TUFF PERFORMANCE;;
|
||||
;1297;;灾厄巫咒;;
|
||||
;1298;;子弹呼啸 : 重制;Bullet Whizz : Remake;BWR
|
||||
mybiomesobeautiful;1299;;My Biomes Is So Beautiful;;
|
||||
create-capitalist;1300;;Create Capitalist;;
|
||||
diving-beyond;1301;;Diving Beyond;;
|
||||
;1302;;奇星·奥术;Mystic Star_Arcane;
|
||||
guild-adventures;1303;;Guild Adventures;;
|
||||
;1304;;艾斯爱慕:新视野;Spore and M:New Horizons;SMNH
|
||||
otherworld-dnd;1305;;Otherworld [Dungeons & Dragons];;
|
||||
;1306;;奇幻起源;Fantasy Origins;
|
||||
projects;1307;;ProjectS;;
|
||||
atheism;1308;;无神论;Atheism;
|
||||
;1309;;神之征伐;Apotheosis Conquest;
|
||||
the-adventure-of-valkyriens-2;1310;;瓦尔基里大冒险2;The Adventure of Valkyriens 2;TAOV2
|
||||
;1311;;超然多味;Various flavors of supernatural;vfos
|
||||
all-the-mons;1312;;All the Mons;;ATMons
|
||||
starskyblock;1313;;Star Sky Factory;;
|
||||
;1314;;拔刀之旅;Battou No Tabi;
|
||||
;1315;;物语;Stories;
|
||||
;1316;;圣末纪元;Holy End Era;HEE
|
||||
arcane-ascension;1317;;Arcane Ascension;;
|
||||
the-cordyceps-fungus;1318;;The Cordyceps Fungus;;
|
||||
bth-beyond-the-horizon;1319;;Beyond The Horizon;;BTH
|
||||
chosens-create-integrated;1320;;Chosen's Create: Integrated;;
|
||||
;1321;;织路;Travel Extensively;TE
|
||||
;1322;;MineZ v.无尽苦寒之地;MineZ v.I.C.E;
|
||||
;1323;;森语田园;;
|
||||
;1324;;子弹呼啸;Bullet Whizz;BW
|
||||
forgemechtrek;1325;;锻械游行;ForgeMechTrek;FMT
|
||||
;1326;;生电与优化整合包;Electricity Generation Integration Package;EGIP
|
||||
create-perfect-world-post-production;1327;;Create - Perfect World Post Production;;
|
||||
terrafirmagreg-modern;1328;;群峦格雷:现代版;TerraFirmaGreg: Modern;TFG
|
||||
nanomagic;1329;;NanoMagic;;
|
||||
;1330;;接入铁路网络:沉浸铁路;IR Railway Network Access (Immersive Railroading);RNA-IR
|
||||
biohazard-project-genesis;1331;;Biohazard: Project Genesis - The Ultimate Apocalypse;;
|
||||
;1332;;齐柏林的启示录;Apocalypse of Zeppelin;AoZ
|
||||
;1333;;遗尘往事;Story of Forgotten Land;SOFL
|
||||
farming-crossing-6-dinner-party;1334;;Farming Crossing 6: Dinner Party!;;
|
||||
;1335;;血族机械师;vampire mechanic;VM
|
||||
;1336;;维度行者:天启旅途;;
|
||||
;1337;;乌托邦探险之旅;Utopian Journey;UJ
|
||||
;1338;;统合防御·钢铁晨曦;United Defense: Steel Dawn;UDSD
|
||||
;1339;;机械动力:枪火不断;Create: Gunfire Never Stops;CGNS
|
||||
;1340;;逆转未来;Battle For The Future;BFF
|
||||
day-of-mind;1341;;DayOfMind;;DOM
|
||||
;1342;;机械动力:探险生存 2;Create Adventure Survival 2;
|
||||
;1343;;云游四海;WAYFARING;WF
|
||||
;1344;;阿卡迪亚的天启;The Apocalypse of Arcadia;TAOA
|
||||
;1345;;纯净原版・焕新;Pure Vanilla Renewal;PVR
|
||||
;1346;;命轮无章;Infinite Random;IR
|
||||
;1347;;星辉科技;StellarLightTech;STL
|
||||
dragns-o-suite-pack;1348;;DragN's O-Suite Pack;;
|
||||
;1349;;机械动力:工业与牧歌;Create: Industry and Pastoral;CIAP
|
||||
;1350;;灾厄纪行;;
|
||||
beebeeblock-the-skyhive;1351;;蜂蜂空坊;Beebeeblock: The Skyhive;BTS
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -341,6 +341,10 @@ public abstract sealed class GameVersionNumber implements Comparable<GameVersion
|
||||
needNormalize = true;
|
||||
releaseType = ReleaseType.SNAPSHOT;
|
||||
eaVersion = VersionNumber.asVersion(suffix.substring(" Snapshot ".length()));
|
||||
} else if (suffix.startsWith("-pre-")) {
|
||||
needNormalize = true;
|
||||
releaseType = ReleaseType.PRE_RELEASE;
|
||||
eaVersion = VersionNumber.asVersion(suffix.substring("-pre-".length()));
|
||||
} else if (suffix.startsWith("-pre")) {
|
||||
releaseType = ReleaseType.PRE_RELEASE;
|
||||
eaVersion = VersionNumber.asVersion(suffix.substring("-pre".length()));
|
||||
|
||||
@@ -436,6 +436,7 @@ public final class GameVersionNumberTest {
|
||||
assertNormalized("1.21.11-pre3", "1.21.11 Pre-Release 3");
|
||||
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11 Pre-Release 3 Unobfuscated");
|
||||
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11-pre3 Unobfuscated");
|
||||
assertNormalized("26.1-pre1", "26.1-pre-1");
|
||||
assertNormalized("1.21.11-rc1", "1.21.11 Release Candidate 1");
|
||||
assertNormalized("1.21.11-rc1_unobfuscated", "1.21.11 Release Candidate 1 Unobfuscated");
|
||||
assertNormalized("1.14_combat-212796", "1.14.3 - Combat Test");
|
||||
|
||||
@@ -64,6 +64,12 @@ public abstract class ParseModDataTask extends DefaultTask {
|
||||
Pattern.compile("^/legacy/mc-mods/minecraft/(\\d+)-(?<modid>[\\w-]+)"),
|
||||
};
|
||||
|
||||
private static String parseName(String name) {
|
||||
return name.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">");
|
||||
}
|
||||
|
||||
private static String parseCurseforge(String url) {
|
||||
URI res = URI.create(url.replace(" ", "%20"));
|
||||
|
||||
@@ -148,9 +154,9 @@ public abstract class ParseModDataTask extends DefaultTask {
|
||||
"# Copyright (C) 2025. All Rights Reserved.\n" +
|
||||
"#\n");
|
||||
for (ModData mod : modDatas) {
|
||||
String chineseName = mod.name.main;
|
||||
String subName = mod.name.sub;
|
||||
String abbr = mod.name.abbr;
|
||||
String chineseName = parseName(mod.name.main);
|
||||
String subName = parseName(mod.name.sub);
|
||||
String abbr = parseName(mod.name.abbr);
|
||||
|
||||
chineseName = chineseName == null ? "" : cleanChineseName(chineseName);
|
||||
if (subName == null)
|
||||
@@ -195,11 +201,13 @@ public abstract class ParseModDataTask extends DefaultTask {
|
||||
List<String> modId = new ArrayList<>();
|
||||
if (mod.modid != null) {
|
||||
for (String id : mod.modid) {
|
||||
if (id.contains(MOD_SEPARATOR)) {
|
||||
String cleanId = parseName(id.trim());
|
||||
|
||||
if (cleanId.contains(MOD_SEPARATOR) || cleanId.contains(S)) {
|
||||
throw new GradleException("Error modid: " + id);
|
||||
}
|
||||
|
||||
modId.add(id);
|
||||
modId.add(cleanId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in new issue
Block a user