Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private StageNode(String stage) {
case "hmcl.install.fabric" -> i18n("install.installer.install", i18n("install.installer.fabric") + " " + stageValue);
case "hmcl.install.fabric-api" -> i18n("install.installer.install", i18n("install.installer.fabric-api") + " " + stageValue);
case "hmcl.install.legacyfabric" -> i18n("install.installer.install", i18n("install.installer.legacyfabric") + " " + stageValue);
case "hmcl.install.legacyfabric-api" -> i18n("install.installer.install", i18n("install.installer.legacyfabric-api") + " " + stageValue);
case "hmcl.install.legacyfabric-api" -> i18n("install.installer.install", i18n("install.installer.legacy-fabric-api") + " " + stageValue);
case "hmcl.install.quilt" -> i18n("install.installer.install", i18n("install.installer.quilt") + " " + stageValue);
case "hmcl.install.quilt-api" -> i18n("install.installer.install", i18n("install.installer.quilt-api") + " " + stageValue);
default -> i18n(stageKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,18 @@
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.*;
import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.download.ComponentRemoteVersion;
import org.jackhuang.hmcl.download.ComponentVersionList;
import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.download.cleanroom.CleanroomRemoteVersion;
import org.jackhuang.hmcl.download.fabric.FabricAPIRemoteVersion;
import org.jackhuang.hmcl.download.fabric.FabricRemoteVersion;
import org.jackhuang.hmcl.download.fabriclike.ModrinthComponentRemoteVersion;
import org.jackhuang.hmcl.download.forge.ForgeRemoteVersion;
import org.jackhuang.hmcl.download.game.GameRemoteVersion;
import org.jackhuang.hmcl.download.legacyfabric.LegacyFabricAPIRemoteVersion;
import org.jackhuang.hmcl.download.legacyfabric.LegacyFabricRemoteVersion;
import org.jackhuang.hmcl.download.liteloader.LiteLoaderRemoteVersion;
import org.jackhuang.hmcl.download.neoforge.NeoForgeRemoteVersion;
import org.jackhuang.hmcl.download.optifine.OptiFineRemoteVersion;
import org.jackhuang.hmcl.download.quilt.QuiltAPIRemoteVersion;
import org.jackhuang.hmcl.download.quilt.QuiltRemoteVersion;
import org.jackhuang.hmcl.game.GameComponentType;
import org.jackhuang.hmcl.setting.GameInstanceIconType;
Expand Down Expand Up @@ -279,12 +277,20 @@ else if (remoteVersion instanceof CleanroomRemoteVersion)
iconType = GameInstanceIconType.CLEANROOM;
else if (remoteVersion instanceof NeoForgeRemoteVersion)
iconType = GameInstanceIconType.NEO_FORGE;
else if (remoteVersion instanceof LegacyFabricRemoteVersion || remoteVersion instanceof LegacyFabricAPIRemoteVersion)
else if (remoteVersion instanceof LegacyFabricRemoteVersion)
iconType = GameInstanceIconType.LEGACY_FABRIC;
else if (remoteVersion instanceof FabricRemoteVersion || remoteVersion instanceof FabricAPIRemoteVersion)
else if (remoteVersion instanceof FabricRemoteVersion)
iconType = GameInstanceIconType.FABRIC;
else if (remoteVersion instanceof QuiltRemoteVersion || remoteVersion instanceof QuiltAPIRemoteVersion)
else if (remoteVersion instanceof QuiltRemoteVersion)
iconType = GameInstanceIconType.QUILT;
else if (remoteVersion instanceof ModrinthComponentRemoteVersion modrinthComponentRemoteVersion) {
iconType = switch (modrinthComponentRemoteVersion.getComponentType()) {
case LEGACY_FABRIC_API -> GameInstanceIconType.LEGACY_FABRIC;
case FABRIC_API -> GameInstanceIconType.FABRIC;
case QUILT_API -> GameInstanceIconType.QUILT;
default -> GameInstanceIconType.COMMAND;
};
}
else
iconType = GameInstanceIconType.COMMAND;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
import javafx.scene.layout.*;
import javafx.stage.FileChooser;
import org.jackhuang.hmcl.addon.AddonLoader;
import org.jackhuang.hmcl.download.DownloadProvider;
import org.jackhuang.hmcl.game.*;
import org.jackhuang.hmcl.addon.mod.ModLoaderType;
import org.jackhuang.hmcl.addon.RemoteAddon;
import org.jackhuang.hmcl.addon.RemoteAddonRepository;
import org.jackhuang.hmcl.addon.mod.ModLoaderType;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ERROR] [com.puppycrawl.tools.checkstyle.checks.imports.RedundantImportCheck]

Duplicate import to line 35 - org.jackhuang.hmcl.addon.mod.ModLoaderType.

import org.jackhuang.hmcl.download.DownloadProvider;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ERROR] [com.puppycrawl.tools.checkstyle.checks.imports.RedundantImportCheck]

Duplicate import to line 33 - org.jackhuang.hmcl.download.DownloadProvider.

import org.jackhuang.hmcl.game.GameInstanceID;
import org.jackhuang.hmcl.game.HMCLGameInstance;
import org.jackhuang.hmcl.game.HMCLGameRepository;
import org.jackhuang.hmcl.task.FileDownloadTask;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
import org.jackhuang.hmcl.addon.AddonLoader;
import org.jackhuang.hmcl.addon.RemoteAddon;
import org.jackhuang.hmcl.addon.RemoteAddonRepository;
import org.jackhuang.hmcl.addon.repository.CurseForgeRemoteAddonRepository;
import org.jackhuang.hmcl.addon.repository.ModrinthRemoteAddonRepository;
import org.jackhuang.hmcl.game.*;
import org.jackhuang.hmcl.addon.mod.LocalModFile;
import org.jackhuang.hmcl.addon.mod.ModLoaderType;
import org.jackhuang.hmcl.addon.mod.ModManager;
import org.jackhuang.hmcl.addon.repository.CurseForgeRemoteAddonRepository;
import org.jackhuang.hmcl.addon.repository.ModrinthRemoteAddonRepository;
import org.jackhuang.hmcl.game.*;
import org.jackhuang.hmcl.setting.DownloadProviders;
import org.jackhuang.hmcl.setting.GameDirectory;
import org.jackhuang.hmcl.setting.GameInstanceIconType;
Expand All @@ -75,7 +75,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.Objects;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.locks.ReentrantLock;
Expand Down
21 changes: 8 additions & 13 deletions HMCL/src/main/java/org/jackhuang/hmcl/util/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.jackhuang.hmcl.addon.mod.ModLoaderType;
import org.jackhuang.hmcl.download.ComponentRemoteVersion;
import org.jackhuang.hmcl.download.cleanroom.CleanroomInstallTask;
import org.jackhuang.hmcl.download.fabric.FabricAPIInstallTask;
import org.jackhuang.hmcl.download.fabric.FabricInstallTask;
import org.jackhuang.hmcl.download.fabriclike.FabricLikeInstallTask;
import org.jackhuang.hmcl.download.fabriclike.ModrinthComponentInstallTask;
import org.jackhuang.hmcl.download.forge.ForgeNewInstallTask;
import org.jackhuang.hmcl.download.forge.ForgeOldInstallTask;
import org.jackhuang.hmcl.download.game.GameAssetDownloadTask;
Expand All @@ -35,8 +35,6 @@
import org.jackhuang.hmcl.download.neoforge.NeoForgeInstallTask;
import org.jackhuang.hmcl.download.neoforge.NeoForgeOldInstallTask;
import org.jackhuang.hmcl.download.optifine.OptiFineInstallTask;
import org.jackhuang.hmcl.download.quilt.QuiltAPIInstallTask;
import org.jackhuang.hmcl.download.quilt.QuiltInstallTask;
import org.jackhuang.hmcl.game.HMCLModpackInstallTask;
import org.jackhuang.hmcl.java.JavaInstallTask;
import org.jackhuang.hmcl.modpack.MinecraftInstanceTask;
Expand Down Expand Up @@ -64,7 +62,8 @@
import java.io.InputStream;
import java.net.URL;
import java.time.temporal.TemporalAccessor;
import java.util.*;
import java.util.Locale;
import java.util.ResourceBundle;

public final class I18n {

Expand Down Expand Up @@ -201,14 +200,10 @@ public static String translateLoaderName(AddonLoader loader) {
return i18n("install.installer.install", i18n("install.installer.liteloader"));
} else if (task instanceof OptiFineInstallTask) {
return i18n("install.installer.install", i18n("install.installer.optifine"));
} else if (task instanceof FabricInstallTask) {
return i18n("install.installer.install", i18n("install.installer.fabric"));
} else if (task instanceof FabricAPIInstallTask) {
return i18n("install.installer.install", i18n("install.installer.fabric-api"));
} else if (task instanceof QuiltInstallTask) {
return i18n("install.installer.install", i18n("install.installer.quilt"));
} else if (task instanceof QuiltAPIInstallTask) {
return i18n("install.installer.install", i18n("install.installer.quilt-api"));
} else if (task instanceof FabricLikeInstallTask) {
task.setName(i18n("install.installer.install", i18n("install.installer.fabric")));
} else if (task instanceof ModrinthComponentInstallTask modrinthComponentInstallTask) {
task.setName(i18n("install.installer.install", i18n("install.installer." + modrinthComponentInstallTask.getVersion().projectId())));
} else if (task instanceof CurseCompletionTask || task instanceof ModrinthCompletionTask || task instanceof ServerModpackCompletionTask || task instanceof McbbsModpackCompletionTask) {
return i18n("modpack.completion");
} else if (task instanceof ModpackInstallTask) {
Expand Down
2 changes: 1 addition & 1 deletion HMCL/src/main/resources/assets/lang/I18N.properties
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ install.installer.do_not_install=Do not install
install.installer.fabric=Fabric
install.installer.fabric-api=Fabric API
install.installer.legacyfabric=Legacy Fabric
install.installer.legacyfabric-api=Legacy Fabric API
install.installer.legacy-fabric-api=Legacy Fabric API
install.installer.fabric-quilt-api.warning=%1$s is a mod and will be installed into the mod directory of the game instance. Please do not change the working directory of the game, or the %1$s will not function. If you do want to change the directory, you should reinstall it.
install.installer.forge=Forge
install.installer.neoforge=NeoForge
Expand Down
2 changes: 1 addition & 1 deletion HMCL/src/main/resources/assets/lang/I18N_ar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ install.installer.do_not_install=لا تثبّت
install.installer.fabric=Fabric
install.installer.fabric-api=Fabric API
install.installer.legacyfabric=Legacy Fabric
install.installer.legacyfabric-api=Legacy Fabric API
install.installer.legacy-fabric-api=Legacy Fabric API
install.installer.fabric-quilt-api.warning=%1$s هو مود وسيتم تثبيته في مجلد مودات نسخة اللعبة. يُرجى عدم تغيير مجلد عمل اللعبة، وإلا لن يعمل %1$s. إذا أردت تغيير المجلد، يجب إعادة تثبيته.
install.installer.forge=Forge
install.installer.neoforge=NeoForge
Expand Down
2 changes: 1 addition & 1 deletion HMCL/src/main/resources/assets/lang/I18N_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ install.installer.do_not_install=Nicht installieren
install.installer.fabric=Fabric
install.installer.fabric-api=Fabric API
install.installer.legacyfabric=Legacy Fabric
install.installer.legacyfabric-api=Legacy Fabric API
install.installer.legacy-fabric-api=Legacy Fabric API
install.installer.fabric-quilt-api.warning=%1$s ist ein Mod und wird in das Mod-Verzeichnis der Spielinstanz installiert. Bitte ändern Sie das Arbeitsverzeichnis des Spiels nicht, da der %1$s sonst nicht funktioniert. Wenn Sie das Verzeichnis ändern möchten, sollten Sie es neu installieren.
install.installer.forge=Forge
install.installer.neoforge=NeoForge
Expand Down
2 changes: 1 addition & 1 deletion HMCL/src/main/resources/assets/lang/I18N_uk.properties
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ install.installer.do_not_install=Не встановлювати
install.installer.fabric=Fabric
install.installer.fabric-api=Fabric API
install.installer.legacyfabric=Legacy Fabric
install.installer.legacyfabric-api=Legacy Fabric API
install.installer.legacy-fabric-api=Legacy Fabric API
install.installer.fabric-quilt-api.warning=%1$s - це мод, і він буде встановлений у каталог модів екземпляра гри. Не змінюйте робочий каталог гри, інакше %1$s не працюватиме. Якщо ви все ж хочете змінити каталог, вам слід перевстановити його.
install.installer.forge=Forge
install.installer.neoforge=NeoForge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ install.installer.do_not_install=不安装
install.installer.fabric=Fabric
install.installer.fabric-api=Fabric API
install.installer.legacyfabric=Legacy Fabric
install.installer.legacyfabric-api=Legacy Fabric API
install.installer.legacy-fabric-api=Legacy Fabric API
install.installer.fabric-quilt-api.warning=%1$s 是一个模组,将会被安装到新游戏的模组文件夹。请你在安装游戏后不要修改当前游戏的“版本隔离”设置。如果你在之后修改了相关设置,则需要重新安装 %1$s。
install.installer.forge=Forge
install.installer.neoforge=NeoForge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ install.installer.do_not_install=不安裝
install.installer.fabric=Fabric
install.installer.fabric-api=Fabric API
install.installer.legacyfabric=Legacy Fabric
install.installer.legacyfabric-api=Legacy Fabric API
install.installer.legacy-fabric-api=Legacy Fabric API
install.installer.fabric-quilt-api.warning=%1$s 是一個模組,將會被安裝到新遊戲的模組目錄。請你在安裝遊戲後不要修改目前遊戲的「執行路徑」設定。如果你在之後修改了相關設定,則需要重新安裝 %1$s。
install.installer.forge=Forge
install.installer.neoforge=NeoForge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@
package org.jackhuang.hmcl.download;

import org.jackhuang.hmcl.download.cleanroom.CleanroomVersionList;
import org.jackhuang.hmcl.download.fabric.FabricAPIVersionList;
import org.jackhuang.hmcl.download.fabric.FabricVersionList;
import org.jackhuang.hmcl.download.fabriclike.ModrinthComponentVersionList;
import org.jackhuang.hmcl.download.forge.ForgeBMCLVersionList;
import org.jackhuang.hmcl.download.game.GameVersionList;
import org.jackhuang.hmcl.download.legacyfabric.LegacyFabricAPIVersionList;
import org.jackhuang.hmcl.download.legacyfabric.LegacyFabricVersionList;
import org.jackhuang.hmcl.download.liteloader.LiteLoaderBMCLVersionList;
import org.jackhuang.hmcl.download.neoforge.NeoForgeBMCLVersionList;
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltVersionList;
import org.jackhuang.hmcl.game.GameComponentType;
import org.jackhuang.hmcl.util.Pair;
Expand All @@ -46,33 +44,33 @@ public final class BMCLAPIDownloadProvider implements DownloadProvider {
private final String apiRoot;
private final GameVersionList game;
private final FabricVersionList fabric;
private final FabricAPIVersionList fabricApi;
private final ModrinthComponentVersionList fabricApi;
private final ForgeBMCLVersionList forge;
private final CleanroomVersionList cleanroom;
private final LegacyFabricVersionList legacyFabric;
private final LegacyFabricAPIVersionList legacyFabricApi;
private final ModrinthComponentVersionList legacyFabricApi;
private final NeoForgeBMCLVersionList neoforge;
private final LiteLoaderBMCLVersionList liteLoader;
private final OptiFineBMCLVersionList optifine;
private final QuiltVersionList quilt;
private final QuiltAPIVersionList quiltApi;
private final ModrinthComponentVersionList quiltApi;
private final List<Pair<String, String>> replacement;
private final List<Pair<String, String>> fallbackReplacement;

public BMCLAPIDownloadProvider(String apiRoot) {
this.apiRoot = apiRoot;
this.game = new GameVersionList(this);
this.fabric = new FabricVersionList(this);
this.fabricApi = new FabricAPIVersionList(this);
this.fabricApi = new ModrinthComponentVersionList(this, GameComponentType.FABRIC_API, "P7dR8mSH");
this.forge = new ForgeBMCLVersionList(apiRoot);
this.cleanroom = new CleanroomVersionList(this);
this.neoforge = new NeoForgeBMCLVersionList(apiRoot);
this.liteLoader = new LiteLoaderBMCLVersionList(this);
this.optifine = new OptiFineBMCLVersionList(apiRoot);
this.quilt = new QuiltVersionList(this);
this.quiltApi = new QuiltAPIVersionList(this);
this.quiltApi = new ModrinthComponentVersionList(this, GameComponentType.QUILT_API, "qvIfYCYJ");
this.legacyFabric = new LegacyFabricVersionList(this);
this.legacyFabricApi = new LegacyFabricAPIVersionList(this);
this.legacyFabricApi = new ModrinthComponentVersionList(this, GameComponentType.LEGACY_FABRIC_API, "9CJED7xi");

this.replacement = List.of(
pair("https://bmclapi2.bangbang93.com", apiRoot),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@
package org.jackhuang.hmcl.download;

import org.jackhuang.hmcl.download.cleanroom.CleanroomVersionList;
import org.jackhuang.hmcl.download.fabric.FabricAPIVersionList;
import org.jackhuang.hmcl.download.fabric.FabricVersionList;
import org.jackhuang.hmcl.download.fabriclike.ModrinthComponentVersionList;
import org.jackhuang.hmcl.download.forge.ForgeVersionList;
import org.jackhuang.hmcl.download.game.GameVersionList;
import org.jackhuang.hmcl.download.legacyfabric.LegacyFabricAPIVersionList;
import org.jackhuang.hmcl.download.legacyfabric.LegacyFabricVersionList;
import org.jackhuang.hmcl.download.liteloader.LiteLoaderVersionList;
import org.jackhuang.hmcl.download.neoforge.NeoForgeOfficialVersionList;
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList;
import org.jackhuang.hmcl.download.quilt.QuiltVersionList;
import org.jackhuang.hmcl.game.GameComponentType;
import org.jackhuang.hmcl.util.io.NetworkUtils;
Expand All @@ -42,33 +40,33 @@
public class MojangDownloadProvider implements DownloadProvider {
private final GameVersionList game;
private final FabricVersionList fabric;
private final FabricAPIVersionList fabricApi;
private final ModrinthComponentVersionList fabricApi;
private final ForgeVersionList forge;
private final NeoForgeOfficialVersionList neoforge;
private final CleanroomVersionList cleanroom;
private final LiteLoaderVersionList liteLoader;
private final OptiFineBMCLVersionList optifine;
private final QuiltVersionList quilt;
private final QuiltAPIVersionList quiltApi;
private final ModrinthComponentVersionList quiltApi;
private final LegacyFabricVersionList legacyFabric;
private final LegacyFabricAPIVersionList legacyFabricApi;
private final ModrinthComponentVersionList legacyFabricApi;

public MojangDownloadProvider() {
// If there is no official download channel available, fallback to BMCLAPI.
String apiRoot = "https://bmclapi2.bangbang93.com";

this.game = new GameVersionList(this);
this.fabric = new FabricVersionList(this);
this.fabricApi = new FabricAPIVersionList(this);
this.fabricApi = new ModrinthComponentVersionList(this, GameComponentType.FABRIC_API, "P7dR8mSH");
this.forge = new ForgeVersionList(this);
this.neoforge = new NeoForgeOfficialVersionList(this);
this.cleanroom = new CleanroomVersionList(this);
this.liteLoader = new LiteLoaderVersionList(this);
this.optifine = new OptiFineBMCLVersionList(apiRoot);
this.quilt = new QuiltVersionList(this);
this.quiltApi = new QuiltAPIVersionList(this);
this.quiltApi = new ModrinthComponentVersionList(this, GameComponentType.QUILT_API, "qvIfYCYJ");
this.legacyFabric = new LegacyFabricVersionList(this);
this.legacyFabricApi = new LegacyFabricAPIVersionList(this);
this.legacyFabricApi = new ModrinthComponentVersionList(this, GameComponentType.LEGACY_FABRIC_API, "9CJED7xi");
}

@Override
Expand Down
Loading
Loading