diff --git a/HMCL/image/ornithe.png b/HMCL/image/ornithe.png new file mode 100644 index 0000000000..ab7c636241 Binary files /dev/null and b/HMCL/image/ornithe.png differ diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java index 2426a1ced2..1687ab82cd 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java @@ -324,6 +324,8 @@ else if (libraryAnalyzer.has(LibraryAnalyzer.LibraryType.QUILT)) return VersionIconType.QUILT.getIcon(); else if (libraryAnalyzer.has(LibraryAnalyzer.LibraryType.LEGACY_FABRIC)) return VersionIconType.LEGACY_FABRIC.getIcon(); + else if (libraryAnalyzer.has(LibraryAnalyzer.LibraryType.ORNITHE)) + return VersionIconType.ORNITHE.getIcon(); else if (libraryAnalyzer.has(LibraryAnalyzer.LibraryType.NEO_FORGE)) return VersionIconType.NEO_FORGE.getIcon(); else if (libraryAnalyzer.has(LibraryAnalyzer.LibraryType.FORGE)) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionIconType.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionIconType.java index dd19336b8c..b2f595a8f5 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionIconType.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionIconType.java @@ -37,7 +37,8 @@ public enum VersionIconType { QUILT("/assets/img/quilt.png"), APRIL_FOOLS("/assets/img/april_fools.png"), CLEANROOM("/assets/img/cleanroom.png"), - LEGACY_FABRIC("/assets/img/legacyfabric.png") + LEGACY_FABRIC("/assets/img/legacyfabric.png"), + ORNITHE("/assets/img/ornithe.png") ; // Please append new items at last diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java index 7f08e36d55..e259f3f169 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java @@ -95,6 +95,7 @@ public InstallerItem(String id, Style style) { case "game" -> VersionIconType.GRASS; case "fabric", "fabric-api" -> VersionIconType.FABRIC; case "legacyfabric", "legacyfabric-api" -> VersionIconType.LEGACY_FABRIC; + case "ornithe", "ornithe-osl" -> VersionIconType.ORNITHE; case "forge" -> VersionIconType.FORGE; case "cleanroom" -> VersionIconType.CLEANROOM; case "liteloader" -> VersionIconType.CHICKEN; @@ -183,6 +184,8 @@ public InstallerItemGroup(String gameVersion, Style style) { InstallerItem cleanroom = new InstallerItem(CLEANROOM, style); InstallerItem legacyfabric = new InstallerItem(LEGACY_FABRIC, style); InstallerItem legacyfabricApi = new InstallerItem(LEGACY_FABRIC_API, style); + InstallerItem ornithe = new InstallerItem(ORNITHE, style); + InstallerItem ornitheOSL = new InstallerItem(ORNITHE_OSL, style); InstallerItem neoForge = new InstallerItem(NEO_FORGE, style); InstallerItem liteLoader = new InstallerItem(LITELOADER, style); InstallerItem optiFine = new InstallerItem(OPTIFINE, style); @@ -190,12 +193,13 @@ public InstallerItemGroup(String gameVersion, Style style) { InstallerItem quiltApi = new InstallerItem(QUILT_API, style); Map> incompatibleMap = new HashMap<>(); - mutualIncompatible(incompatibleMap, forge, fabric, quilt, neoForge, cleanroom, legacyfabric); - addIncompatibles(incompatibleMap, liteLoader, fabric, quilt, neoForge, cleanroom, legacyfabric); - addIncompatibles(incompatibleMap, optiFine, fabric, quilt, neoForge, cleanroom, liteLoader, legacyfabric); - addIncompatibles(incompatibleMap, fabricApi, forge, quiltApi, neoForge, liteLoader, optiFine, cleanroom, legacyfabric, legacyfabricApi); - addIncompatibles(incompatibleMap, quiltApi, forge, fabric, fabricApi, neoForge, liteLoader, optiFine, cleanroom, legacyfabric, legacyfabricApi); - addIncompatibles(incompatibleMap, legacyfabricApi, forge, fabric, fabricApi, neoForge, liteLoader, optiFine, cleanroom, quilt, quiltApi); + mutualIncompatible(incompatibleMap, forge, fabric, quilt, neoForge, cleanroom, legacyfabric, ornithe); + addIncompatibles(incompatibleMap, liteLoader, fabric, quilt, neoForge, cleanroom, legacyfabric, ornithe); + addIncompatibles(incompatibleMap, optiFine, fabric, quilt, neoForge, cleanroom, liteLoader, legacyfabric, ornithe); + addIncompatibles(incompatibleMap, fabricApi, forge, quiltApi, neoForge, liteLoader, optiFine, cleanroom, legacyfabric, legacyfabricApi, ornithe, ornitheOSL); + addIncompatibles(incompatibleMap, quiltApi, forge, fabric, fabricApi, neoForge, liteLoader, optiFine, cleanroom, legacyfabric, legacyfabricApi, ornithe, ornitheOSL); + addIncompatibles(incompatibleMap, legacyfabricApi, forge, fabric, fabricApi, neoForge, liteLoader, optiFine, cleanroom, quilt, quiltApi, ornitheOSL, ornithe); + addIncompatibles(incompatibleMap, ornitheOSL, forge, fabric, fabricApi, neoForge, liteLoader, optiFine, cleanroom, quilt, quiltApi, legacyfabric, legacyfabricApi); for (Map.Entry> entry : incompatibleMap.entrySet()) { InstallerItem item = entry.getKey(); @@ -229,7 +233,7 @@ public InstallerItemGroup(String gameVersion, Style style) { game.versionProperty.set(new InstalledState(gameVersion, false, false)); } - InstallerItem[] all = {game, forge, neoForge, liteLoader, optiFine, fabric, fabricApi, quilt, quiltApi, legacyfabric, legacyfabricApi, cleanroom}; + InstallerItem[] all = {game, forge, neoForge, liteLoader, optiFine, fabric, fabricApi, quilt, quiltApi, legacyfabric, legacyfabricApi, ornithe, ornitheOSL, cleanroom}; for (InstallerItem item : all) { if (!item.resolvedStateProperty.isBound()) { @@ -246,9 +250,11 @@ public InstallerItemGroup(String gameVersion, Style style) { if (gameVersion == null) { this.libraries = all; } else if (gameVersion.equals("1.12.2")) { - this.libraries = new InstallerItem[]{game, forge, cleanroom, liteLoader, legacyfabric, legacyfabricApi, optiFine}; + this.libraries = new InstallerItem[]{game, forge, cleanroom, liteLoader, legacyfabric, legacyfabricApi, ornithe, ornitheOSL, optiFine}; + } else if (GameVersionNumber.compare(gameVersion, "1.14.4") <= 0 && GameVersionNumber.compare(gameVersion, "1.13.2") >= 0) { + this.libraries = new InstallerItem[]{game, forge, liteLoader, optiFine, fabric, fabricApi, ornithe, ornitheOSL}; } else if (GameVersionNumber.compare(gameVersion, "1.13.2") <= 0) { - this.libraries = new InstallerItem[]{game, forge, liteLoader, optiFine, legacyfabric, legacyfabricApi}; + this.libraries = new InstallerItem[]{game, forge, liteLoader, optiFine, legacyfabric, legacyfabricApi, ornithe, ornitheOSL}; } else { this.libraries = new InstallerItem[]{game, forge, neoForge, optiFine, fabric, fabricApi, quilt, quiltApi}; } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java index 08c390a95e..cd893ec9d0 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java @@ -46,6 +46,8 @@ 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.ornithe.OrnitheInstallTask; +import org.jackhuang.hmcl.download.ornithe.OrnitheOSLInstallTask; import org.jackhuang.hmcl.download.quilt.QuiltAPIInstallTask; import org.jackhuang.hmcl.download.quilt.QuiltInstallTask; import org.jackhuang.hmcl.game.HMCLModpackInstallTask; @@ -184,6 +186,10 @@ public void onRunning(Task task) { task.setName(i18n("install.installer.install", i18n("install.installer.fabric"))); } else if (task instanceof FabricAPIInstallTask) { task.setName(i18n("install.installer.install", i18n("install.installer.fabric-api"))); + } else if (task instanceof OrnitheInstallTask) { + task.setName(i18n("install.installer.install", i18n("install.installer.ornithe"))); + } else if (task instanceof OrnitheOSLInstallTask) { + task.setName(i18n("install.installer.install", i18n("install.installer.ornithe-osl"))); } else if (task instanceof QuiltInstallTask) { task.setName(i18n("install.installer.install", i18n("install.installer.quilt"))); } else if (task instanceof QuiltAPIInstallTask) { @@ -455,6 +461,8 @@ private StageNode(String stage) { 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.ornithe" -> i18n("install.installer.install", i18n("install.installer.ornithe") + " " + stageValue); + case "hmcl.install.ornithe-osl" -> i18n("install.installer.install", i18n("install.installer.ornithe-osl") + " " + 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); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AbstractInstallersPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AbstractInstallersPage.java index 4c1d8919b4..f6aa354612 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AbstractInstallersPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AbstractInstallersPage.java @@ -60,6 +60,7 @@ public AbstractInstallersPage(WizardController controller, String gameVersion, D library.setOnInstall(() -> { if (!Boolean.TRUE.equals(config().getShownTips().get(FABRIC_QUILT_API_TIP)) && (LibraryAnalyzer.LibraryType.FABRIC_API.getPatchId().equals(libraryId) + || LibraryAnalyzer.LibraryType.ORNITHE_OSL.getPatchId().equals(libraryId) || LibraryAnalyzer.LibraryType.QUILT_API.getPatchId().equals(libraryId) || LibraryAnalyzer.LibraryType.LEGACY_FABRIC_API.getPatchId().equals(libraryId))) { Controllers.dialog(new MessageDialogPane.Builder( diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java index 3d07ed74b6..b907096511 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java @@ -132,6 +132,7 @@ private void setTxtNameWithLoaders() { case LITELOADER -> "LiteLoader"; case QUILT -> "Quilt"; case OPTIFINE -> "OptiFine"; + case ORNITHE -> "Ornithe"; default -> null; }; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java index a602b2f75e..03fa432bea 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java @@ -43,6 +43,8 @@ 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.ornithe.OrnitheOSLRemoteVersion; +import org.jackhuang.hmcl.download.ornithe.OrnitheRemoteVersion; import org.jackhuang.hmcl.download.quilt.QuiltAPIRemoteVersion; import org.jackhuang.hmcl.download.quilt.QuiltRemoteVersion; import org.jackhuang.hmcl.setting.VersionIconType; @@ -268,6 +270,8 @@ else if (remoteVersion instanceof CleanroomRemoteVersion) iconType = VersionIconType.CLEANROOM; else if (remoteVersion instanceof NeoForgeRemoteVersion) iconType = VersionIconType.NEO_FORGE; + else if (remoteVersion instanceof OrnitheRemoteVersion || remoteVersion instanceof OrnitheOSLRemoteVersion) + iconType = VersionIconType.ORNITHE; else if (remoteVersion instanceof LegacyFabricRemoteVersion || remoteVersion instanceof LegacyFabricAPIRemoteVersion) iconType = VersionIconType.LEGACY_FABRIC; else if (remoteVersion instanceof FabricRemoteVersion || remoteVersion instanceof FabricAPIRemoteVersion) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/AdvancedVersionSettingPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/AdvancedVersionSettingPage.java index 6db255756f..c4ea031e52 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/AdvancedVersionSettingPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/AdvancedVersionSettingPage.java @@ -27,6 +27,7 @@ import javafx.scene.layout.*; import org.jackhuang.hmcl.game.NativesDirectoryType; import org.jackhuang.hmcl.game.Renderer; +import org.jackhuang.hmcl.mod.ModLoaderType; import org.jackhuang.hmcl.setting.Profile; import org.jackhuang.hmcl.setting.VersionSetting; import org.jackhuang.hmcl.ui.FXUtils; @@ -122,7 +123,14 @@ public AdvancedVersionSettingPage(Profile profile, @Nullable String versionId, V pane.addRow(3, new Label(i18n("settings.advanced.post_exit_command")), txtPostExitCommand); HintPane hintPane = new HintPane(); - hintPane.setText(i18n("settings.advanced.custom_commands.hint")); + StringBuilder sb = new StringBuilder(i18n("settings.advanced.custom_commands.hint")); + for (ModLoaderType type : ModLoaderType.values()) { + if (type.getId() != null) { + sb.append("\n"); + sb.append(i18n("settings.advanced.custon_commands.env",type.getId(),i18n("install.installer." + type.getId().toLowerCase(Locale.ROOT)))); + } + } + hintPane.setText(sb.toString()); GridPane.setColumnSpan(hintPane, 2); pane.addRow(4, hintPane); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/InstallerListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/InstallerListPage.java index c8d8791f16..a908c47ae5 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/InstallerListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/InstallerListPage.java @@ -85,6 +85,11 @@ public void loadVersion(Profile profile, String versionId) { continue; } + // Skip ornithe osl + if (libraryId.equals(LibraryAnalyzer.LibraryType.ORNITHE_OSL.getPatchId())) { + continue; + } + String libraryVersion = analyzer.getVersion(libraryId).orElse(null); if (libraryVersion != null) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java index 3c738da352..cee45f51f0 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java @@ -158,6 +158,10 @@ private void updateSupportedLoaders(ModManager modManager) { supportedLoaders.add(ModLoaderType.FABRIC); } + if (analyzer.has(LibraryAnalyzer.LibraryType.ORNITHE)) { + supportedLoaders.add(ModLoaderType.FABRIC); + } + if (analyzer.has(LibraryAnalyzer.LibraryType.FABRIC) && modManager.hasMod("kilt", ModLoaderType.FABRIC)) { supportedLoaders.add(ModLoaderType.FORGE); supportedLoaders.add(ModLoaderType.NEO_FORGED); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java index bad72233f5..24ffdc62d3 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java @@ -477,6 +477,7 @@ final class ModInfoDialog extends JFXDialogLayout { case FABRIC -> i18n("install.installer.fabric"); case LITE_LOADER -> i18n("install.installer.liteloader"); case QUILT -> i18n("install.installer.quilt"); + case ORNITHE -> i18n("install.installer.ornithe"); default -> null; }; if (loaderName == null) @@ -647,6 +648,7 @@ protected void updateControl(ModInfoObject dataItem, boolean empty) { case FABRIC -> content.addTagWarning(i18n("install.installer.fabric")); case LITE_LOADER -> content.addTagWarning(i18n("install.installer.liteloader")); case QUILT -> content.addTagWarning(i18n("install.installer.quilt")); + case ORNITHE -> content.addTagWarning(i18n("install.installer.ornithe")); } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionIconDialog.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionIconDialog.java index a48fc63a09..f769d7e24c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionIconDialog.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionIconDialog.java @@ -65,6 +65,7 @@ public VersionIconDialog(Profile profile, String versionId, Runnable onFinish) { createIcon(VersionIconType.CRAFT_TABLE), createIcon(VersionIconType.FABRIC), createIcon(VersionIconType.LEGACY_FABRIC), + createIcon(VersionIconType.ORNITHE), createIcon(VersionIconType.FORGE), createIcon(VersionIconType.CLEANROOM), createIcon(VersionIconType.NEO_FORGE), diff --git a/HMCL/src/main/resources/assets/img/ornithe.png b/HMCL/src/main/resources/assets/img/ornithe.png new file mode 100644 index 0000000000..363b25e65c Binary files /dev/null and b/HMCL/src/main/resources/assets/img/ornithe.png differ diff --git a/HMCL/src/main/resources/assets/img/ornithe@2x.png b/HMCL/src/main/resources/assets/img/ornithe@2x.png new file mode 100644 index 0000000000..3c80f4413e Binary files /dev/null and b/HMCL/src/main/resources/assets/img/ornithe@2x.png differ diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index d3a31603b2..d45d0f6f1a 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -743,12 +743,14 @@ install.installer.install=Installing %s install.installer.install_offline=Install/Update from Local File install.installer.install_offline.tooltip=We support using the local (Neo)Forge, Cleanroom, and OptiFine installer. install.installer.install_online=Online Install -install.installer.install_online.tooltip=We currently support Forge, NeoForge, Cleanroom, OptiFine, Fabric, Legacy Fabric, Quilt, and LiteLoader. +install.installer.install_online.tooltip=We currently support Forge, NeoForge, Cleanroom, OptiFine, Fabric, Legacy Fabric, Ornithe, Quilt, and LiteLoader. install.installer.liteloader=LiteLoader install.installer.not_installed=Not installed install.installer.optifine=OptiFine install.installer.quilt=Quilt install.installer.quilt-api=QSL/QFAPI +install.installer.ornithe=Ornithe +install.installer.ornithe-osl=Ornithe OSL install.installer.version=%s install.installer.external_version=%s (Installed by external process, which cannot be configured) install.installing=Installing @@ -1114,7 +1116,7 @@ mods.mcmod.page=MCMod Page mods.mcmod.search=Search in MCMod mods.modrinth=Modrinth mods.name=Name -mods.not_modded=You must install a modloader (Forge, NeoForge, Fabric, Legacy Fabric, Quilt, or LiteLoader) first to manage your mods! +mods.not_modded=You must install a modloader (Forge, NeoForge, Fabric, Legacy Fabric, Ornithe, Quilt, or LiteLoader) first to manage your mods! mods.restore=Restore mods.url=Official Page mods.update_modpack_mod.warning=Updating mods in a modpack can lead to irreparable results, possibly corrupting the modpack so that it cannot launch. Are you sure you want to update? @@ -1317,15 +1319,8 @@ settings.advanced.custom_commands.hint=The following environment variables are p \ · $INST_ID: instance name.\n\ \ · $INST_DIR: absolute path of the instance working directory.\n\ \ · $INST_MC_DIR: absolute path of the game directory.\n\ - \ · $INST_JAVA: java binary used for launch.\n\ - \ · $INST_FORGE: set if Forge is installed.\n\ - \ · $INST_NEOFORGE: set if NeoForge is installed.\n\ - \ · $INST_CLEANROOM: set if Cleanroom is installed.\n\ - \ · $INST_LITELOADER: set if LiteLoader is installed.\n\ - \ · $INST_OPTIFINE: set if OptiFine is installed.\n\ - \ · $INST_FABRIC: set if Fabric is installed.\n\ - \ · $INST_LEGACYFABRIC: set if Legacy Fabric is installed.\n\ - \ · $INST_QUILT: set if Quilt is installed. + \ · $INST_JAVA: java binary used for launch. +settings.advanced.custon_commands.env= \ · $INST_%s: set if %s is installed.; settings.advanced.dont_check_game_completeness=Do not check game integrity settings.advanced.dont_check_jvm_validity=Do not check JVM compatibility settings.advanced.dont_patch_natives=Do not attempt to automatically replace native libraries diff --git a/HMCL/src/main/resources/assets/lang/I18N_ar.properties b/HMCL/src/main/resources/assets/lang/I18N_ar.properties index fe96befb92..44769011ba 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ar.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ar.properties @@ -1303,20 +1303,6 @@ settings.advanced=الإعدادات المتقدمة settings.advanced.modify=تعديل الإعدادات المتقدمة settings.advanced.title=الإعدادات المتقدمة - %s settings.advanced.custom_commands=أوامر مخصصة -settings.advanced.custom_commands.hint=المتغيرات البيئية التالية متاحة:\n\ - \ · $INST_NAME: اسم النسخة.\n\ - \ · $INST_ID: اسم النسخة.\n\ - \ · $INST_DIR: المسار المطلق لمجلد عمل النسخة.\n\ - \ · $INST_MC_DIR: المسار المطلق لمجلد اللعبة.\n\ - \ · $INST_JAVA: ملف Java المستخدم للتشغيل.\n\ - \ · $INST_FORGE: يُضبط إذا كان Forge مثبّتاً.\n\ - \ · $INST_NEOFORGE: يُضبط إذا كان NeoForge مثبّتاً.\n\ - \ · $INST_CLEANROOM: يُضبط إذا كان Cleanroom مثبّتاً.\n\ - \ · $INST_LITELOADER: يُضبط إذا كان LiteLoader مثبّتاً.\n\ - \ · $INST_OPTIFINE: يُضبط إذا كان OptiFine مثبّتاً.\n\ - \ · $INST_FABRIC: يُضبط إذا كان Fabric مثبّتاً.\n\ - \ · $INST_LEGACYFABRIC: يُضبط إذا كان Legacy Fabric مثبّتاً.\n\ - \ · $INST_QUILT: يُضبط إذا كان Quilt مثبّتاً. settings.advanced.dont_check_game_completeness=عدم التحقق من سلامة اللعبة settings.advanced.dont_check_jvm_validity=عدم التحقق من توافق JVM settings.advanced.dont_patch_natives=عدم محاولة استبدال المكتبات الأصلية تلقائياً diff --git a/HMCL/src/main/resources/assets/lang/I18N_es.properties b/HMCL/src/main/resources/assets/lang/I18N_es.properties index 9fe2f6d7fd..b2b514c894 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_es.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_es.properties @@ -697,7 +697,7 @@ install.installer.install=Instalando %s install.installer.install_offline=Instalar/actualizar desde archivo local install.installer.install_offline.tooltip=Apoyamos el uso del instalador local de (Neo)Forge/Cleanroom/OptiFine. install.installer.install_online=Instalación en línea -install.installer.install_online.tooltip=Actualmente soportamos Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Quilt, LiteLoader y OptiFine. +install.installer.install_online.tooltip=Actualmente soportamos Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Ornithe, Quilt, LiteLoader y OptiFine. install.installer.liteloader=LiteLoader install.installer.not_installed=No está instalado install.installer.optifine=OptiFine @@ -1060,7 +1060,7 @@ mods.mcmod.page=Página de MCMod mods.mcmod.search=Búsqueda en MCMod mods.modrinth=Modrinth mods.name=Nombre -mods.not_modded=¡Debes instalar primero un cargador de mods (Forge, NeoForge, Fabric, Legacy Fabric, Quilt o LiteLoader) para gestionar tus mods! +mods.not_modded=¡Debes instalar primero un cargador de mods (Forge, NeoForge, Fabric, Legacy Fabric, Ornithe, Quilt o LiteLoader) para gestionar tus mods! mods.restore=Restaurar mods.url=Página oficial mods.update_modpack_mod.warning=Actualizar mods en un modpack puede generar resultados irreparables, posiblemente corrompiendo el modpack para que no pueda iniciarse. ¿Seguro que quieres actualizar? @@ -1214,19 +1214,6 @@ settings.advanced=Configuración avanzada settings.advanced.modify=Editar configuración avanzada settings.advanced.title=Configuración avanzada - %s settings.advanced.custom_commands=Comandos personalizados -settings.advanced.custom_commands.hint=Se proporcionan las siguientes variables de entorno:\n\ - \ · $INST_NAME: nombre de la instancia.\n\ - \ · $INST_ID: nombre de la instancia.\n\ - \ · $INST_DIR: ruta absoluta del directorio de trabajo de la instancia.\n\ - \ · $INST_MC_DIR: ruta absoluta del directorio del juego.\n\ - \ · $INST_JAVA: binario de java utilizado para la ejecución\n\ - \ · $INST_FORGE: disponible si Forge está instalado.\n\ - \ · $INST_NEOFORGE: disponible si NeoForge está instalado.\n\ - \ · $INST_CLEANROOM: disponible si Cleanroom está instalado.\n\ - \ · $INST_LITELOADER: disponible si LiteLoader está instalado.\n\ - \ · $INST_OPTIFINE: disponible si OptiFine está instalado.\n\ - \ · $INST_FABRIC: disponible si Fabric está instalado.\n\ - \ · $INST_QUILT: disponible si Quilt está instalado. settings.advanced.dont_check_game_completeness=No chequear integridad del juego settings.advanced.dont_check_jvm_validity=No comprobar la compatibilidad con JVM settings.advanced.dont_patch_natives=No intente sustituir automáticamente las bibliotecas nativas diff --git a/HMCL/src/main/resources/assets/lang/I18N_ja.properties b/HMCL/src/main/resources/assets/lang/I18N_ja.properties index 51e4cbbd43..d3ccb517ae 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ja.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ja.properties @@ -744,18 +744,6 @@ settings=設定 settings.advanced=詳細設定 settings.advanced.title=詳細設定 - %s settings.advanced.custom_commands=カスタムコマンド -settings.advanced.custom_commands.hint=カスタムコマンドは、次の環境変数を使用して実行されます。\n \ - \-$ INST_NAME:バージョンの名前\n \ - \-$ INST_ID:バージョンの名前\n \ - \-$ INST_DIR:バージョンの絶対パス\n \ - \-$ INST_MC_DIR:Minecraftの絶対パス\n \ - \-$ INST_JAVA:起動に使用されるJavaバイナリ\n \ - \-$ INST_FORGE:Forgeがインストールされている場合に設定\n \ - \-$ INST_NEOFORGE:NeoForgeがインストールされている場合に設定\n \ - \-$ INST_LITELOADER:LiteLoaderがインストールされている場合に設定\n \ - \-$ INST_OPTIFINE:OptiFineがインストールされている場合に設定\n \ - \-$ INST_FABRIC:ファブリックがインストールされている場合に設定\n \ - \-$ INST_QUILT:ファブリックがインストールされている場合に設定 settings.advanced.dont_check_game_completeness=ゲームファイルをスキャンしない settings.advanced.dont_check_jvm_validity=JVMがゲームを起動できるかどうかを確認しないでください settings.advanced.game_dir.default=標準(.minecraft /) diff --git a/HMCL/src/main/resources/assets/lang/I18N_lzh.properties b/HMCL/src/main/resources/assets/lang/I18N_lzh.properties index 96ab3d777f..b10f562c8c 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_lzh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_lzh.properties @@ -1026,19 +1026,6 @@ settings.advanced=進階置設 settings.advanced.modify=篡進階置設 settings.advanced.title=進階置設 - %s settings.advanced.custom_commands=自定命令 -settings.advanced.custom_commands.hint=自定之令見召,当含下列环境易数:\n\ - \ · $INST_NAME:例名;\n\ - \ · $INST_ID:例名;\n\ - \ · $INST_DIR:現例運行之徑;\n\ - \ · $INST_MC_DIR:現戲案夾之徑;\n\ - \ · $INST_JAVA:戲行所用之爪哇徑;\n\ - \ · $INST_FORGE:倘置鍛,则存此易数;\n\ - \ · $INST_NEOFORGE:倘置新鍛,则存此易数;\n\ - \ · $INST_CLEANROOM:倘置 Cleanroom,则存此易数;\n\ - \ · $INST_LITELOADER:倘置輕載,则存此易数;\n\ - \ · $INST_OPTIFINE:倘置 OptiFine,则存此易数;\n\ - \ · $INST_FABRIC:倘置緞,则存此易数;\n\ - \ · $INST_QUILT:倘置褥,则存此易数。 settings.advanced.dont_check_game_completeness=弗驗案之備否 settings.advanced.dont_check_jvm_validity=弗校爪哇虛機與戲之兼否 settings.advanced.dont_patch_natives=弗圖替府庫 diff --git a/HMCL/src/main/resources/assets/lang/I18N_ru.properties b/HMCL/src/main/resources/assets/lang/I18N_ru.properties index df20bd5705..241f41873d 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_ru.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_ru.properties @@ -688,7 +688,7 @@ install.installer.install=Установить %s install.installer.install_offline=Установить/обновить из локального файла install.installer.install_offline.tooltip=Поддерживаются установщики (Neo)Forge/Cleanroom/OptiFine. install.installer.install_online=Установить с интернета -install.installer.install_online.tooltip=Поддерживаются Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Quilt, LiteLoader и OptiFine. +install.installer.install_online.tooltip=Поддерживаются Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Ornithe, Quilt, LiteLoader и OptiFine. install.installer.liteloader=LiteLoader install.installer.not_installed=Не установлено install.installer.optifine=OptiFine @@ -1053,7 +1053,7 @@ mods.mcmod.page=Страница MCMod mods.mcmod.search=Искать на MCMod mods.modrinth=Modrinth mods.name=Название -mods.not_modded=Для управления модами необходимо сначала установить загрузчик (Forge, NeoForge, Fabric, Legacy Fabric, Quilt или LiteLoader)! +mods.not_modded=Для управления модами необходимо сначала установить загрузчик (Forge, NeoForge, Fabric, Legacy Fabric, Ornithe, Quilt или LiteLoader)! mods.restore=Восстановить mods.url=Официальная страница mods.update_modpack_mod.warning=Обновление модов в пакете модов может привести к непоправимым результатам, возможно, повредить пакет модов так, что он не сможет запуститься. Вы уверены, что хотите обновить? @@ -1206,18 +1206,6 @@ settings.advanced=Расширенные настройки settings.advanced.modify=Изменить расширенные настройки settings.advanced.title=Расширенные настройки - %s settings.advanced.custom_commands=Пользовательские команды -settings.advanced.custom_commands.hint=Пользовательские команды выполняются со следующими переменными окружения:\n\ - \ · $INST_NAME: название сборки.\n\ - \ · $INST_ID: название сборки.\n\ - \ · $INST_DIR: абсолютный путь к рабочей папке сборки.\n\ - \ · $INST_MC_DIR: абсолютный путь к текущей папке игры.\n\ - \ · $INST_JAVA: двоичный файл java, используемый для запуска.\n\ - \ · $INST_FORGE: устанавливается, если установлен Forge.\n\ - \ · $INST_NEOFORGE: устанавливается, если установлен NeoForge.\n\ - \ · $INST_LITELOADER: устанавливается, если установлен LiteLoader.\n\ - \ · $INST_OPTIFINE: устанавливается, если установлен OptiFine.\n\ - \ · $INST_FABRIC: устанавливается, если установлен Fabric.\n\ - \ · $INST_QUILT: устанавливается, если установлен Quilt. settings.advanced.dont_check_game_completeness=Не проверять целостность игры settings.advanced.dont_check_jvm_validity=Не проверять совместимость JVM settings.advanced.dont_patch_natives=Не пытайтесь автоматически заменить нативные библиотеки diff --git a/HMCL/src/main/resources/assets/lang/I18N_uk.properties b/HMCL/src/main/resources/assets/lang/I18N_uk.properties index 3726c5abe6..e1e6cfa37d 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_uk.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_uk.properties @@ -639,7 +639,7 @@ install.installer.install=Встановлення %s install.installer.install_offline=Встановити/Оновити з локального файлу install.installer.install_offline.tooltip=Ми підтримуємо використання локального інсталятора (Neo)Forge/Cleanroom/OptiFine. install.installer.install_online=Онлайн встановлення -install.installer.install_online.tooltip=Наразі ми підтримуємо Forge, NeoForge, Cleanroom, OptiFine, Fabric, Legacy Fabric, Quilt та LiteLoader. +install.installer.install_online.tooltip=Наразі ми підтримуємо Forge, NeoForge, Cleanroom, OptiFine, Fabric, Legacy Fabric, Ornithe, Quilt та LiteLoader. install.installer.liteloader=LiteLoader install.installer.not_installed=Не встановлено install.installer.optifine=OptiFine @@ -1000,7 +1000,7 @@ mods.mcmod.page=Сторінка MCMod mods.mcmod.search=Пошук в MCMod mods.modrinth=Modrinth mods.name=Назва -mods.not_modded=Ви повинні спочатку встановити завантажувач модів (Forge, NeoForge, Fabric, Legacy Fabric, Quilt або LiteLoader), щоб керувати своїми модами! +mods.not_modded=Ви повинні спочатку встановити завантажувач модів (Forge, NeoForge, Fabric, Legacy Fabric, Ornithe, Quilt або LiteLoader), щоб керувати своїми модами! mods.restore=Відновити mods.url=Офіційна сторінка mods.update_modpack_mod.warning=Оновлення модів у модпаку може призвести до непоправних наслідків, можливо, пошкодивши модпак так, що він не зможе запуститися. Ви впевнені, що хочете оновити? @@ -1154,18 +1154,6 @@ settings.advanced=Розширені налаштування settings.advanced.modify=Редагувати розширені налаштування settings.advanced.title=Розширені налаштування - %s settings.advanced.custom_commands=Власні команди -settings.advanced.custom_commands.hint=Надано наступні змінні середовища: \n\ - \ · $INST_NAME: назва екземпляра. \n\ - \ · $INST_ID: назва екземпляра. \n\ - \ · $INST_DIR: абсолютний шлях до робочого каталогу екземпляра. \n\ - \ · $INST_MC_DIR: абсолютний шлях до каталогу гри. \n\ - \ · $INST_JAVA: двійковий файл java, що використовується для запуску. \n\ - \ · $INST_FORGE: встановлено, якщо Forge встановлено. \n\ - \ · $INST_NEOFORGE: встановлено, якщо NeoForge встановлено. \n\ - \ · $INST_LITELOADER: встановлено, якщо LiteLoader встановлено. \n\ - \ · $INST_OPTIFINE: встановлено, якщо OptiFine встановлено. \n\ - \ · $INST_FABRIC: встановлено, якщо Fabric встановлено. \n\ - \ · $INST_QUILT: встановлено, якщо Quilt встановлено. settings.advanced.dont_check_game_completeness=Не перевіряти цілісність гри settings.advanced.dont_check_jvm_validity=Не перевіряти сумісність JVM settings.advanced.dont_patch_natives=Не намагатися автоматично замінити нативні бібліотеки diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index 4f003327cc..9afb1991c4 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -547,12 +547,14 @@ install.installer.install=安裝 %s install.installer.install_offline=從本機檔案安裝或升級 install.installer.install_offline.tooltip=支援匯入已經下載好的 (Neo)Forge、Cleanroom 及 OptiFine 安裝器 install.installer.install_online=線上安裝 -install.installer.install_online.tooltip=支援安裝 Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Quilt、LiteLoader 和 OptiFine +install.installer.install_online.tooltip=支援安裝 Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Ornithe、 Quilt、LiteLoader 和 OptiFine install.installer.liteloader=LiteLoader install.installer.not_installed=未安裝 install.installer.optifine=OptiFine install.installer.quilt=Quilt install.installer.quilt-api=QSL/QFAPI +install.installer.ornithe=Ornithe +install.installer.ornithe-osl=Ornithe OSL install.installer.version=%s install.installer.external_version=%s [由外部安裝的版本,無法解除安裝或更換] install.installing=安裝 @@ -908,7 +910,7 @@ mods.mcmod.page=MC 百科頁面 mods.mcmod.search=MC 百科檢索 mods.modrinth=Modrinth mods.name=名稱 -mods.not_modded=你需要先在「自動安裝」頁面安裝 Forge、NeoForge、Fabric、Legacy Fabric、Quilt 或 LiteLoader 才能管理模組。 +mods.not_modded=你需要先在「自動安裝」頁面安裝 Forge、NeoForge、Fabric、Legacy Fabric、Ornithe、 Quilt 或 LiteLoader 才能管理模組。 mods.restore=回退 mods.url=官方頁面 mods.update_modpack_mod.warning=更新模組包中的模組可能導致模組包損壞,使模組包無法正常啟動。該操作不可逆,確定要更新嗎? @@ -1107,15 +1109,8 @@ settings.advanced.custom_commands.hint=自訂指令被呼叫時將包含如下 \ · $INST_ID: 實例名稱;\n\ \ · $INST_DIR: 目前實例執行路徑;\n\ \ · $INST_MC_DIR: 目前遊戲目錄路徑;\n\ - \ · $INST_JAVA: 遊戲執行使用的 Java 路徑;\n\ - \ · $INST_FORGE: 若安裝了 Forge,將會存在本環境變數;\n\ - \ · $INST_NEOFORGE: 若安裝了 NeoForge,將會存在本環境變數;\n\ - \ · $INST_CLEANROOM: 若安裝了 Cleanroom,將會存在本環境變數;\n\ - \ · $INST_LITELOADER: 若安裝了 LiteLoader,將會存在本環境變數;\n\ - \ · $INST_OPTIFINE: 若安裝了 OptiFine,將會存在本環境變數;\n\ - \ · $INST_FABRIC: 若安裝了 Fabric,將會存在本環境變數;\n\ - \ · $INST_LEGACYFABRIC: 若安裝了 Legacy Fabric,將會存在本環境變數;\n\ - \ · $INST_QUILT: 若安裝了 Quilt,將會存在本環境變數。 + \ · $INST_JAVA: 遊戲執行使用的 Java 路徑; +settings.advanced.custon_commands.env= \ · $INST_%s: 若安裝了 %s,將會存在本環境變數。 settings.advanced.dont_check_game_completeness=不檢查遊戲完整性 settings.advanced.dont_check_jvm_validity=不檢查 Java 虛擬機與遊戲的相容性 settings.advanced.dont_patch_natives=不嘗試自動取代本機庫 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 38f96a7fe2..69c3df3400 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -552,12 +552,14 @@ install.installer.install=安装 %s install.installer.install_offline=从本地文件安装/升级 install.installer.install_offline.tooltip=支持导入已经下载好的 (Neo)Forge、Cleanroom 和 OptiFine 安装器 install.installer.install_online=在线安装 -install.installer.install_online.tooltip=支持安装 Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Quilt、LiteLoader 和 OptiFine +install.installer.install_online.tooltip=支持安装 Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Ornithe、 Quilt、LiteLoader 和 OptiFine install.installer.liteloader=LiteLoader install.installer.not_installed=未安装 install.installer.optifine=OptiFine install.installer.quilt=Quilt install.installer.quilt-api=QSL/QFAPI +install.installer.ornithe=Ornithe +install.installer.ornithe-osl=Ornithe OSL install.installer.version=%s install.installer.external_version=%s (由外部安装的版本,无法卸载或更换) install.installing=安装 @@ -913,7 +915,7 @@ mods.mcmod.page=MC 百科页面 mods.mcmod.search=MC 百科搜索 mods.modrinth=Modrinth mods.name=名称 -mods.not_modded=你需要先在“自动安装”页面安装 Forge、NeoForge、Fabric、Legacy Fabric、Quilt 或 LiteLoader 才能管理模组。 +mods.not_modded=你需要先在“自动安装”页面安装 Forge、NeoForge、Fabric、Legacy Fabric、Ornithe、 Quilt 或 LiteLoader 才能管理模组。 mods.restore=回退 mods.url=官方页面 mods.update_modpack_mod.warning=更新整合包中的模组可能导致整合包损坏,使整合包无法正常启动。该操作不可逆,确定要更新吗? @@ -1112,15 +1114,8 @@ settings.advanced.custom_commands.hint=自定义命令被调用时将包含如 \ · $INST_ID: 实例名称;\n\ \ · $INST_DIR: 当前实例运行路径;\n\ \ · $INST_MC_DIR: 当前游戏文件夹路径;\n\ - \ · $INST_JAVA: 游戏运行使用的 Java 路径;\n\ - \ · $INST_FORGE: 若安装了 Forge,将会存在本环境变量;\n\ - \ · $INST_NEOFORGE: 若安装了 NeoForge,将会存在本环境变量;\n\ - \ · $INST_CLEANROOM: 若安装了 Cleanroom,将会存在本环境变量;\n\ - \ · $INST_LITELOADER: 若安装了 LiteLoader,将会存在本环境变量;\n\ - \ · $INST_OPTIFINE: 若安装了 OptiFine,将会存在本环境变量;\n\ - \ · $INST_FABRIC: 若安装了 Fabric,将会存在本环境变量;\n\ - \ · $INST_LEGACYFABRIC: 若安装了 Legacy Fabric,将会存在本环境变量;\n\ - \ · $INST_QUILT: 若安装了 Quilt,将会存在本环境变量。 + \ · $INST_JAVA: 游戏运行使用的 Java 路径; +settings.advanced.custon_commands.env= \ · $INST_%s: 若安装了 %s,将会存在本环境变量; settings.advanced.dont_check_game_completeness=不检查游戏完整性 settings.advanced.dont_check_jvm_validity=不检查 Java 虚拟机与游戏的兼容性 settings.advanced.dont_patch_natives=不尝试自动替换本地库 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java index b23a7867f7..47f7d333c2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java @@ -27,6 +27,8 @@ 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.ornithe.OrnitheOSLVersionList; +import org.jackhuang.hmcl.download.ornithe.OrnitheVersionList; import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList; import org.jackhuang.hmcl.download.quilt.QuiltVersionList; import org.jackhuang.hmcl.util.Pair; @@ -55,6 +57,8 @@ public final class BMCLAPIDownloadProvider implements DownloadProvider { private final OptiFineBMCLVersionList optifine; private final QuiltVersionList quilt; private final QuiltAPIVersionList quiltApi; + private final OrnitheVersionList ornithe; + private final OrnitheOSLVersionList ornitheOSL; private final List> replacement; private final List> fallbackReplacement; @@ -72,6 +76,8 @@ public BMCLAPIDownloadProvider(String apiRoot) { this.quiltApi = new QuiltAPIVersionList(this); this.legacyFabric = new LegacyFabricVersionList(this); this.legacyFabricApi = new LegacyFabricAPIVersionList(this); + this.ornithe = new OrnitheVersionList(this); + this.ornitheOSL = new OrnitheOSLVersionList(this); this.replacement = List.of( pair("https://bmclapi2.bangbang93.com", apiRoot), @@ -134,6 +140,8 @@ public VersionList getVersionListById(String id) { case "quilt-api" -> quiltApi; case "legacyfabric" -> legacyFabric; case "legacyfabric-api" -> legacyFabricApi; + case "ornithe" -> ornithe; + case "ornithe-osl" -> ornitheOSL; default -> throw new IllegalArgumentException("Unrecognized version list id: " + id); }; } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/LibraryAnalyzer.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/LibraryAnalyzer.java index f0c1b62ae1..2bbf052f61 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/LibraryAnalyzer.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/LibraryAnalyzer.java @@ -54,6 +54,12 @@ public Optional getLibrary(LibraryType type) { return Optional.ofNullable(libraries.get(type.getPatchId())).map(Pair::getKey); } + public Set getLibraries() { + return Arrays.stream(LibraryType.values()) + .filter(this::has) + .collect(Collectors.toSet()); + } + /** * If a library is provided in $.patches, it's structure is so clear that we can do any operation. * Otherwise, we must guess how are these libraries mixed. @@ -172,7 +178,8 @@ public static boolean isModded(VersionProvider provider, Version version) { return mainClass != null && (LAUNCH_WRAPPER_MAIN.equals(mainClass) || mainClass.startsWith("net.minecraftforge") || mainClass.startsWith("net.neoforged") - || mainClass.startsWith("top.outlands") //Cleanroom + || mainClass.startsWith("top.outlands") // Cleanroom + || mainClass.startsWith("net.ornithemc") || mainClass.startsWith("net.fabricmc") || mainClass.startsWith("org.quiltmc") || mainClass.startsWith("cpw.mods")); @@ -219,6 +226,21 @@ protected boolean matchLibrary(Library library, List libraries) { } }, FABRIC_API(true, "fabric-api", "net\\.fabricmc", "fabric-api", null), + ORNITHE(true, "ornithe", "net\\.fabricmc", "fabric-loader", ModLoaderType.ORNITHE) { + @Override + protected boolean matchLibrary(Library library, List libraries) { + if (!super.matchLibrary(library, libraries)) { + return false; + } + for (Library l : libraries) { + if ("net.ornithemc".equals(l.getGroupId())) { + return false; + } + } + return true; + } + }, + ORNITHE_OSL(true, "ornithe-osl", "net\\.ornithemc", "ornithe-api", null), FORGE(true, "forge", "net\\.minecraftforge", "(forge|fmlloader)", ModLoaderType.FORGE) { private final Pattern FORGE_VERSION_MATCHER = Pattern.compile("^([0-9.]+)-(?[0-9.]+)(-([0-9.]+))?$"); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java index 716acbcc39..9e12a80b2f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java @@ -27,6 +27,8 @@ 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.ornithe.OrnitheOSLVersionList; +import org.jackhuang.hmcl.download.ornithe.OrnitheVersionList; import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList; import org.jackhuang.hmcl.download.quilt.QuiltVersionList; import org.jackhuang.hmcl.util.io.NetworkUtils; @@ -51,6 +53,8 @@ public class MojangDownloadProvider implements DownloadProvider { private final QuiltAPIVersionList quiltApi; private final LegacyFabricVersionList legacyFabric; private final LegacyFabricAPIVersionList legacyFabricApi; + private final OrnitheVersionList ornithe; + private final OrnitheOSLVersionList ornitheOSL; public MojangDownloadProvider() { // If there is no official download channel available, fallback to BMCLAPI. @@ -68,6 +72,8 @@ public MojangDownloadProvider() { this.quiltApi = new QuiltAPIVersionList(this); this.legacyFabric = new LegacyFabricVersionList(this); this.legacyFabricApi = new LegacyFabricAPIVersionList(this); + this.ornithe = new OrnitheVersionList(this); + this.ornitheOSL = new OrnitheOSLVersionList(this); } @Override @@ -95,6 +101,8 @@ public VersionList getVersionListById(String id) { case "quilt-api" -> quiltApi; case "legacyfabric" -> legacyFabric; case "legacyfabric-api" -> legacyFabricApi; + case "ornithe" -> ornithe; + case "ornithe-osl" -> ornitheOSL; default -> throw new IllegalArgumentException("Unrecognized version list id: " + id); }; } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/fabric/FabricInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/fabric/FabricInstallTask.java index b21586201a..0d95200fcb 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/fabric/FabricInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/fabric/FabricInstallTask.java @@ -129,28 +129,7 @@ private Version getPatch(FabricInfo fabricInfo, String gameVersion, String loade } @JsonSerializable - public static class FabricInfo { - private final LoaderInfo loader; - private final IntermediaryInfo intermediary; - private final JsonObject launcherMeta; - - public FabricInfo(LoaderInfo loader, IntermediaryInfo intermediary, JsonObject launcherMeta) { - this.loader = loader; - this.intermediary = intermediary; - this.launcherMeta = launcherMeta; - } - - public LoaderInfo getLoader() { - return loader; - } - - public IntermediaryInfo getIntermediary() { - return intermediary; - } - - public JsonObject getLauncherMeta() { - return launcherMeta; - } + public record FabricInfo(LoaderInfo loader, IntermediaryInfo intermediary, JsonObject launcherMeta) { } @JsonSerializable diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/legacyfabric/LegacyFabricInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/legacyfabric/LegacyFabricInstallTask.java index f2abb9c33a..731ac4935d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/legacyfabric/LegacyFabricInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/legacyfabric/LegacyFabricInstallTask.java @@ -80,7 +80,7 @@ public void execute() { } private Version getPatch(FabricInstallTask.FabricInfo legacyFabricInfo, String gameVersion, String loaderVersion) { - JsonObject launcherMeta = legacyFabricInfo.getLauncherMeta(); + JsonObject launcherMeta = legacyFabricInfo.launcherMeta(); Arguments arguments = new Arguments(); String mainClass; @@ -107,8 +107,8 @@ private Version getPatch(FabricInstallTask.FabricInfo legacyFabricInfo, String g } // libraries.add(new Library(Artifact.fromDescriptor(legacyFabricInfo.hashed.maven), getMavenRepositoryByGroup(legacyFabricInfo.hashed.maven), null)); - libraries.add(new Library(Artifact.fromDescriptor(legacyFabricInfo.getIntermediary().getMaven()), getMavenRepositoryByGroup(legacyFabricInfo.getIntermediary().getMaven()), null)); - libraries.add(new Library(Artifact.fromDescriptor(legacyFabricInfo.getLoader().getMaven()), getMavenRepositoryByGroup(legacyFabricInfo.getLoader().getMaven()), null)); + libraries.add(new Library(Artifact.fromDescriptor(legacyFabricInfo.intermediary().getMaven()), getMavenRepositoryByGroup(legacyFabricInfo.intermediary().getMaven()), null)); + libraries.add(new Library(Artifact.fromDescriptor(legacyFabricInfo.loader().getMaven()), getMavenRepositoryByGroup(legacyFabricInfo.loader().getMaven()), null)); return new Version(LibraryAnalyzer.LibraryType.LEGACY_FABRIC.getPatchId(), loaderVersion, Version.PRIORITY_LOADER, arguments, mainClass, libraries); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheInstallTask.java new file mode 100644 index 0000000000..f2bb6b2283 --- /dev/null +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheInstallTask.java @@ -0,0 +1,135 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2020 huangyuhui 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 . + */ +package org.jackhuang.hmcl.download.ornithe; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import org.jackhuang.hmcl.download.DefaultDependencyManager; +import org.jackhuang.hmcl.download.LibraryAnalyzer; +import org.jackhuang.hmcl.download.UnsupportedInstallationException; +import org.jackhuang.hmcl.download.fabric.FabricInstallTask; +import org.jackhuang.hmcl.game.Arguments; +import org.jackhuang.hmcl.game.Artifact; +import org.jackhuang.hmcl.game.Library; +import org.jackhuang.hmcl.game.Version; +import org.jackhuang.hmcl.task.GetTask; +import org.jackhuang.hmcl.task.Task; +import org.jackhuang.hmcl.util.gson.JsonSerializable; +import org.jackhuang.hmcl.util.gson.JsonUtils; + +import java.io.IOException; +import java.util.*; + +import static org.jackhuang.hmcl.download.UnsupportedInstallationException.FABRIC_NOT_COMPATIBLE_WITH_FORGE; + +/** + * Note: Fabric should be installed first. + * + * @author huangyuhui + */ +public final class OrnitheInstallTask extends Task { + + private final DefaultDependencyManager dependencyManager; + private final Version version; + private final OrnitheRemoteVersion remote; + private final GetTask launchMetaTask; + private final List> dependencies = new ArrayList<>(1); + + public OrnitheInstallTask(DefaultDependencyManager dependencyManager, Version version, OrnitheRemoteVersion remoteVersion) { + this.dependencyManager = dependencyManager; + this.version = version; + this.remote = remoteVersion; + + launchMetaTask = new GetTask(dependencyManager.getDownloadProvider().injectURLsWithCandidates(remoteVersion.getUrls())); + launchMetaTask.setCacheRepository(dependencyManager.getCacheRepository()); + } + + @Override + public boolean doPreExecute() { + return true; + } + + @Override + public void preExecute() throws Exception { + if (!Objects.equals("net.minecraft.client.main.Main", version.resolve(dependencyManager.getGameRepository()).getMainClass())) + throw new UnsupportedInstallationException(FABRIC_NOT_COMPATIBLE_WITH_FORGE); + } + + @Override + public Collection> getDependents() { + return Collections.singleton(launchMetaTask); + } + + @Override + public Collection> getDependencies() { + return dependencies; + } + + @Override + public boolean isRelyingOnDependencies() { + return false; + } + + @Override + public void execute() throws IOException { + OrnitheInfo ornitheInfo = JsonUtils.GSON.fromJson(launchMetaTask.getResult(), OrnitheInfo.class); + if (ornitheInfo == null) + throw new IOException("Fabric metadata is invalid"); + + setResult(getPatch(ornitheInfo, remote.getGameVersion(), remote.getSelfVersion())); + + dependencies.add(dependencyManager.checkLibraryCompletionAsync(getResult(), true)); + } + + private Version getPatch(OrnitheInfo ornitheInfo, String gameVersion, String loaderVersion) { + JsonObject launcherMeta = ornitheInfo.launcherMeta(); + Arguments arguments = new Arguments(); + + String mainClass; + if (!launcherMeta.get("mainClass").isJsonObject()) { + mainClass = launcherMeta.get("mainClass").getAsString(); + } else { + mainClass = launcherMeta.get("mainClass").getAsJsonObject().get("client").getAsString(); + } + + if (launcherMeta.has("launchwrapper")) { + String clientTweaker = launcherMeta.get("launchwrapper").getAsJsonObject().get("tweakers").getAsJsonObject().get("client").getAsJsonArray().get(0).getAsString(); + arguments = arguments.addGameArguments("--tweakClass", clientTweaker); + } + + JsonObject librariesObject = launcherMeta.getAsJsonObject("libraries"); + List libraries = new ArrayList<>(); + + // "common, server" is hard coded in fabric installer. + // Don't know the purpose of ignoring client libraries. + for (String side : new String[]{"common", "server"}) { + for (JsonElement element : librariesObject.getAsJsonArray(side)) { + libraries.add(JsonUtils.GSON.fromJson(element, Library.class)); + } + } + + libraries.add(new Library(Artifact.fromDescriptor(ornitheInfo.calamus().getMaven()), "https://maven.ornithemc.net/releases/", null)); + libraries.add(new Library(Artifact.fromDescriptor(ornitheInfo.loader().getMaven()), "https://maven.ornithemc.net/releases/", null)); + + return new Version(LibraryAnalyzer.LibraryType.ORNITHE.getPatchId(), loaderVersion, Version.PRIORITY_LOADER, arguments, mainClass, libraries); + } + + @JsonSerializable + public record OrnitheInfo(FabricInstallTask.LoaderInfo loader, FabricInstallTask.IntermediaryInfo calamus, JsonObject launcherMeta) { + } +} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLInstallTask.java new file mode 100644 index 0000000000..8b3fb9dbe5 --- /dev/null +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLInstallTask.java @@ -0,0 +1,66 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2021 huangyuhui 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 . + */ +package org.jackhuang.hmcl.download.ornithe; + +import org.jackhuang.hmcl.download.DefaultDependencyManager; +import org.jackhuang.hmcl.game.Version; +import org.jackhuang.hmcl.task.FileDownloadTask; +import org.jackhuang.hmcl.task.Task; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Note: Fabric should be installed first. + * + * @author huangyuhui + */ +public final class OrnitheOSLInstallTask extends Task { + + private final DefaultDependencyManager dependencyManager; + private final Version version; + private final OrnitheOSLRemoteVersion remote; + private final List> dependencies = new ArrayList<>(1); + + public OrnitheOSLInstallTask(DefaultDependencyManager dependencyManager, Version version, OrnitheOSLRemoteVersion remoteVersion) { + this.dependencyManager = dependencyManager; + this.version = version; + this.remote = remoteVersion; + } + + @Override + public Collection> getDependencies() { + return dependencies; + } + + @Override + public boolean isRelyingOnDependencies() { + return false; + } + + @Override + public void execute() throws IOException { + dependencies.add(new FileDownloadTask( + remote.getVersion().getFile().getUrl(), + dependencyManager.getGameRepository().getModsDirectory(version.getId()).resolve("ornithe-osl-" + remote.getVersion().getVersion() + ".jar"), + remote.getVersion().getFile().getIntegrityCheck()) + ); + } +} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLRemoteVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLRemoteVersion.java new file mode 100644 index 0000000000..c9bc1633f7 --- /dev/null +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLRemoteVersion.java @@ -0,0 +1,67 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2021 huangyuhui 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 . + */ +package org.jackhuang.hmcl.download.ornithe; + +import org.jackhuang.hmcl.download.DefaultDependencyManager; +import org.jackhuang.hmcl.download.LibraryAnalyzer; +import org.jackhuang.hmcl.download.RemoteVersion; +import org.jackhuang.hmcl.game.Version; +import org.jackhuang.hmcl.mod.RemoteMod; +import org.jackhuang.hmcl.task.Task; + +import java.time.Instant; +import java.util.List; + +public class OrnitheOSLRemoteVersion extends RemoteVersion { + private final String fullVersion; + private final RemoteMod.Version version; + + /** + * Constructor. + * + * @param gameVersion the Minecraft version that this remote version suits. + * @param selfVersion the version string of the remote version. + * @param urls the installer or universal jar original URL. + */ + OrnitheOSLRemoteVersion(String gameVersion, String selfVersion, String fullVersion, Instant datePublished, RemoteMod.Version version, List urls) { + super(LibraryAnalyzer.LibraryType.FABRIC_API.getPatchId(), gameVersion, selfVersion, datePublished, urls); + + this.fullVersion = fullVersion; + this.version = version; + } + + @Override + public String getFullVersion() { + return fullVersion; + } + + public RemoteMod.Version getVersion() { + return version; + } + + @Override + public Task getInstallTask(DefaultDependencyManager dependencyManager, Version baseVersion) { + return new OrnitheOSLInstallTask(dependencyManager, baseVersion, this); + } + + @Override + public int compareTo(RemoteVersion o) { + if (!(o instanceof OrnitheOSLRemoteVersion)) return 0; + return -this.getReleaseDate().compareTo(o.getReleaseDate()); + } +} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLVersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLVersionList.java new file mode 100644 index 0000000000..f8d75c0978 --- /dev/null +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheOSLVersionList.java @@ -0,0 +1,53 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2021 huangyuhui 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 . + */ +package org.jackhuang.hmcl.download.ornithe; + +import org.jackhuang.hmcl.download.DownloadProvider; +import org.jackhuang.hmcl.download.VersionList; +import org.jackhuang.hmcl.mod.RemoteMod; +import org.jackhuang.hmcl.mod.modrinth.ModrinthRemoteModRepository; +import org.jackhuang.hmcl.task.Task; +import org.jackhuang.hmcl.util.Lang; + +import java.util.Collections; + +public class OrnitheOSLVersionList extends VersionList { + + private final DownloadProvider downloadProvider; + + public OrnitheOSLVersionList(DownloadProvider downloadProvider) { + this.downloadProvider = downloadProvider; + } + + @Override + public boolean hasType() { + return false; + } + + @Override + public Task refreshAsync() { + return Task.runAsync(() -> { + for (RemoteMod.Version modVersion : Lang.toIterable(ModrinthRemoteModRepository.MODS.getRemoteVersionsById(downloadProvider, "EHGtwpJv"))) { + for (String gameVersion : modVersion.getGameVersions()) { + versions.put(gameVersion, new OrnitheOSLRemoteVersion(gameVersion, modVersion.getVersion(), modVersion.getName(), modVersion.getDatePublished(), modVersion, + Collections.singletonList(modVersion.getFile().getUrl()))); + } + } + }); + } +} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheRemoteVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheRemoteVersion.java new file mode 100644 index 0000000000..3034d43353 --- /dev/null +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheRemoteVersion.java @@ -0,0 +1,44 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2021 huangyuhui 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 . + */ +package org.jackhuang.hmcl.download.ornithe; + +import org.jackhuang.hmcl.download.DefaultDependencyManager; +import org.jackhuang.hmcl.download.LibraryAnalyzer; +import org.jackhuang.hmcl.download.RemoteVersion; +import org.jackhuang.hmcl.game.Version; +import org.jackhuang.hmcl.task.Task; + +import java.util.List; + +public class OrnitheRemoteVersion extends RemoteVersion { + /** + * Constructor. + * + * @param gameVersion the Minecraft version that this remote version suits. + * @param selfVersion the version string of the remote version. + * @param urls the installer or universal jar original URL. + */ + OrnitheRemoteVersion(String gameVersion, String selfVersion, List urls) { + super(LibraryAnalyzer.LibraryType.ORNITHE.getPatchId(), gameVersion, selfVersion, null, urls); + } + + @Override + public Task getInstallTask(DefaultDependencyManager dependencyManager, Version baseVersion) { + return new OrnitheInstallTask(dependencyManager, baseVersion, this); + } +} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheVersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheVersionList.java new file mode 100644 index 0000000000..4c2c979d1f --- /dev/null +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/ornithe/OrnitheVersionList.java @@ -0,0 +1,80 @@ +/* + * Hello Minecraft! Launcher + * Copyright (C) 2021 huangyuhui 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 . + */ +package org.jackhuang.hmcl.download.ornithe; + +import org.jackhuang.hmcl.download.DownloadProvider; +import org.jackhuang.hmcl.download.VersionList; +import org.jackhuang.hmcl.task.Task; +import org.jackhuang.hmcl.util.gson.JsonSerializable; +import org.jackhuang.hmcl.util.gson.JsonUtils; +import org.jackhuang.hmcl.util.io.NetworkUtils; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static org.jackhuang.hmcl.util.gson.JsonUtils.listTypeOf; + +public final class OrnitheVersionList extends VersionList { + private final DownloadProvider downloadProvider; + + public OrnitheVersionList(DownloadProvider downloadProvider) { + this.downloadProvider = downloadProvider; + } + + @Override + public boolean hasType() { + return false; + } + + @Override + public Task refreshAsync() { + return Task.runAsync(() -> { + List gameVersions = getGameVersions(GAME_META_URL); + List loaderVersions = getGameVersions(LOADER_META_URL); + + lock.writeLock().lock(); + + try { + for (String gameVersion : gameVersions) + for (String loaderVersion : loaderVersions) + versions.put(gameVersion, new OrnitheRemoteVersion(gameVersion, loaderVersion, + Collections.singletonList(getLaunchMetaUrl(gameVersion, loaderVersion)))); + } finally { + lock.writeLock().unlock(); + } + }); + } + + private static final String LOADER_META_URL = "https://meta.ornithemc.net/v2/versions/loader"; + private static final String GAME_META_URL = "https://meta.ornithemc.net/v2/versions/game"; + + private List getGameVersions(String metaUrl) throws IOException { + String json = NetworkUtils.doGet(downloadProvider.injectURLWithCandidates(metaUrl)); + return JsonUtils.GSON.fromJson(json, listTypeOf(GameVersion.class)) + .stream().map(GameVersion::version).collect(Collectors.toList()); + } + + private static String getLaunchMetaUrl(String gameVersion, String loaderVersion) { + return String.format("https://meta.ornithemc.net/v2/versions/loader/%s/%s", gameVersion, loaderVersion); + } + + @JsonSerializable + private record GameVersion(String version, String maven, boolean stable) {} +} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java index 565ddb5db9..2f73c7d1f5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -20,6 +20,7 @@ import org.jackhuang.hmcl.auth.AuthInfo; import org.jackhuang.hmcl.download.LibraryAnalyzer; import org.jackhuang.hmcl.game.*; +import org.jackhuang.hmcl.mod.ModLoaderType; import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.ServerAddress; import org.jackhuang.hmcl.util.StringUtils; @@ -588,30 +589,13 @@ private Map getEnvVars() { } } - if (analyzer.has(LibraryAnalyzer.LibraryType.FORGE)) { - env.put("INST_FORGE", "1"); + for (ModLoaderType type : analyzer.getModLoaders()) { + if (type.getId() != null) env.put("INST_" + type.getId(), "1"); } - if (analyzer.has(LibraryAnalyzer.LibraryType.CLEANROOM)) { - env.put("INST_CLEANROOM", "1"); - } - if (analyzer.has(LibraryAnalyzer.LibraryType.NEO_FORGE)) { - env.put("INST_NEOFORGE", "1"); - } - if (analyzer.has(LibraryAnalyzer.LibraryType.LITELOADER)) { - env.put("INST_LITELOADER", "1"); - } - if (analyzer.has(LibraryAnalyzer.LibraryType.FABRIC)) { - env.put("INST_FABRIC", "1"); - } - if (analyzer.has(LibraryAnalyzer.LibraryType.OPTIFINE)) { + + if (analyzer.getVersion(LibraryAnalyzer.LibraryType.OPTIFINE).isPresent()) { env.put("INST_OPTIFINE", "1"); } - if (analyzer.has(LibraryAnalyzer.LibraryType.QUILT)) { - env.put("INST_QUILT", "1"); - } - if (analyzer.has(LibraryAnalyzer.LibraryType.LEGACY_FABRIC)) { - env.put("INST_LEGACYFABRIC", "1"); - } env.putAll(options.getEnvironmentVariables()); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModLoaderType.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModLoaderType.java index c1205803a6..b542b940d4 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModLoaderType.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModLoaderType.java @@ -18,13 +18,24 @@ package org.jackhuang.hmcl.mod; public enum ModLoaderType { - UNKNOWN, - FORGE, - CLEANROOM, - NEO_FORGED, - FABRIC, - QUILT, - LITE_LOADER, - LEGACY_FABRIC, - PACK + UNKNOWN(null), + FORGE("FORGE"), + CLEANROOM("CLEANROOM"), + NEO_FORGED("NEOFORGE"), + FABRIC("FABRIC"), + ORNITHE("ORNITHE"), + QUILT("QUILT"), + LITE_LOADER("LITELOADER"), + LEGACY_FABRIC("LEGACYFABRIC"), + PACK(null); + + private final String id; + + ModLoaderType(String id) { + this.id = id; + } + + public String getId() { + return id; + } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackExportTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackExportTask.java index 2f8eccd2ae..91320e0acf 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackExportTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackExportTask.java @@ -95,22 +95,11 @@ public void execute() throws Exception { // Mcbbs manifest List addons = new ArrayList<>(); addons.add(new McbbsModpackManifest.Addon(MINECRAFT.getPatchId(), gameVersion)); - analyzer.getVersion(FORGE).ifPresent(forgeVersion -> - addons.add(new McbbsModpackManifest.Addon(FORGE.getPatchId(), forgeVersion))); - analyzer.getVersion(CLEANROOM).ifPresent(cleanroomVersion -> - addons.add(new McbbsModpackManifest.Addon(CLEANROOM.getPatchId(), cleanroomVersion))); - analyzer.getVersion(NEO_FORGE).ifPresent(neoForgeVersion -> - addons.add(new McbbsModpackManifest.Addon(NEO_FORGE.getPatchId(), neoForgeVersion))); - analyzer.getVersion(LITELOADER).ifPresent(liteLoaderVersion -> - addons.add(new McbbsModpackManifest.Addon(LITELOADER.getPatchId(), liteLoaderVersion))); - analyzer.getVersion(OPTIFINE).ifPresent(optifineVersion -> - addons.add(new McbbsModpackManifest.Addon(OPTIFINE.getPatchId(), optifineVersion))); - analyzer.getVersion(FABRIC).ifPresent(fabricVersion -> - addons.add(new McbbsModpackManifest.Addon(FABRIC.getPatchId(), fabricVersion))); - analyzer.getVersion(QUILT).ifPresent(quiltVersion -> - addons.add(new McbbsModpackManifest.Addon(QUILT.getPatchId(), quiltVersion))); - analyzer.getVersion(LEGACY_FABRIC).ifPresent(legacyfabricVersion -> - addons.add(new McbbsModpackManifest.Addon(LEGACY_FABRIC.getPatchId(), legacyfabricVersion))); + for (LibraryAnalyzer.LibraryType type : analyzer.getLibraries()) { + if (type.isModLoader() && !(type == OPTIFINE)) continue; + if (type == MINECRAFT) addons.add(new McbbsModpackManifest.Addon(MINECRAFT.getPatchId(), gameVersion)); + else addons.add(new McbbsModpackManifest.Addon(type.getPatchId(), analyzer.getVersion(type).orElseThrow())); + } List libraries = new ArrayList<>(); // TODO libraries diff --git a/docs/README.md b/docs/README.md index 1379f65050..59f862b29a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -30,7 +30,7 @@ ## Introduction -HMCL is an open-source, cross-platform Minecraft launcher that supports Mod Management, Game Customizing, ModLoader Installing (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Quilt, LiteLoader, and OptiFine), Modpack Creating, UI Customization, and more. +HMCL is an open-source, cross-platform Minecraft launcher that supports Mod Management, Game Customizing, ModLoader Installing (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Ornithe, Quilt, LiteLoader, and OptiFine), Modpack Creating, UI Customization, and more. HMCL has amazing cross-platform capabilities. Not only does it run on different operating systems like Windows, Linux, macOS, and FreeBSD, but it also supports various CPU architectures such as x86, ARM, RISC-V, MIPS, and LoongArch. You can easily enjoy Minecraft across different platforms through HMCL. diff --git a/docs/README_en_Qabs.md b/docs/README_en_Qabs.md index 96c494ede9..e219693915 100644 --- a/docs/README_en_Qabs.md +++ b/docs/README_en_Qabs.md @@ -15,7 +15,7 @@ ˙˥ƆWH ɥƃnoɹɥʇ sɯɹoɟʇɐld ʇuǝɹǝɟɟᴉp ssoɹɔɐ ʇɟɐɹɔǝuᴉW ʎoɾuǝ ʎlᴉsɐǝ uɐɔ no⅄ ˙ɥɔɹ∀ƃuoo˥ puɐ 'SԀIW 'Λ-ƆSIɹ 'Wɹ∀ '98x sɐ ɥɔns sǝɹnʇɔǝʇᴉɥɔɹɐ ∩ԀƆ snoᴉɹɐʌ sʇɹoddns oslɐ ʇᴉ ʇnq 'pSqǝǝɹℲ puɐ 'SOɔɐɯ 'xnuᴉ˥ 'sʍopuᴉM ǝʞᴉl sɯǝʇsʎs ƃuᴉʇɐɹǝdo ʇuǝɹǝɟɟᴉp uo unɹ ʇᴉ sǝop ʎluo ʇoN ˙sǝᴉʇᴉlᴉqɐdɐɔ ɯɹoɟʇɐld-ssoɹɔ ƃuᴉzɐɯɐ sɐɥ ˥ƆWH -˙ǝɹoɯ puɐ 'uoᴉʇɐzᴉɯoʇsnƆ I∩ 'ƃuᴉʇɐǝɹƆ ʞɔɐdpoW '(ǝuᴉℲᴉʇdO puɐ 'ɹǝpɐo˥ǝʇᴉ˥ 'ʇlᴉnQ 'ɔᴉɹqɐℲ ʎɔɐᵷǝꞀ 'ɔᴉɹqɐℲ 'ɯooɹuɐǝlƆ 'ǝƃɹoℲoǝN 'ǝƃɹoℲ) ƃuᴉllɐʇsuI ɹǝpɐo˥poW 'ƃuᴉzᴉɯoʇsnƆ ǝɯɐפ 'ʇuǝɯǝƃɐuɐW poW sʇɹoddns ʇɐɥʇ ɹǝɥɔunɐl ʇɟɐɹɔǝuᴉW ɯɹoɟʇɐld-ssoɹɔ 'ǝɔɹnos-uǝdo uɐ sᴉ ˥ƆWH +˙ǝɹoɯ puɐ 'uoᴉʇɐzᴉɯoʇsnƆ I∩ 'ƃuᴉʇɐǝɹƆ ʞɔɐdpoW '(ǝuᴉℲᴉʇdO puɐ 'ɹǝpɐo˥ǝʇᴉ˥ 'ʇlᴉnQ 'ǝɥʇᴉuɹO 'ɔᴉɹqɐℲ ʎɔɐᵷǝꞀ 'ɔᴉɹqɐℲ 'ɯooɹuɐǝlƆ 'ǝƃɹoℲoǝN 'ǝƃɹoℲ) ƃuᴉllɐʇsuI ɹǝpɐo˥poW 'ƃuᴉzᴉɯoʇsnƆ ǝɯɐפ 'ʇuǝɯǝƃɐuɐW poW sʇɹoddns ʇɐɥʇ ɹǝɥɔunɐl ʇɟɐɹɔǝuᴉW ɯɹoɟʇɐld-ssoɹɔ 'ǝɔɹnos-uǝdo uɐ sᴉ ˥ƆWH ## pɐoluʍoᗡ diff --git a/docs/README_es.md b/docs/README_es.md index 55634b80ec..ceb373cbe3 100644 --- a/docs/README_es.md +++ b/docs/README_es.md @@ -30,7 +30,7 @@ English ([Standard](README.md), [uʍoᗡ ǝpᴉsd∩](README_en_Qabs.md)) | 中 ## Introducción -HMCL es un lanzador de Minecraft de código abierto y multiplataforma que admite la gestión de mods, personalización del juego, instalación de ModLoaders (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Quilt, LiteLoader y OptiFine), creación de modpacks, personalización de la interfaz de usuario y más. +HMCL es un lanzador de Minecraft de código abierto y multiplataforma que admite la gestión de mods, personalización del juego, instalación de ModLoaders (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Ornithe, Quilt, LiteLoader y OptiFine), creación de modpacks, personalización de la interfaz de usuario y más. HMCL tiene increíbles capacidades multiplataforma. No solo funciona en diferentes sistemas operativos como Windows, Linux, macOS y FreeBSD, sino que también es compatible con varias arquitecturas de CPU como x86, ARM, RISC-V, MIPS y LoongArch. Puedes disfrutar fácilmente de Minecraft en diferentes plataformas a través de HMCL. diff --git a/docs/README_ja.md b/docs/README_ja.md index 6d14e9f7b4..4557dd51a3 100644 --- a/docs/README_ja.md +++ b/docs/README_ja.md @@ -30,7 +30,7 @@ English ([Standard](README.md), [uʍoᗡ ǝpᴉsd∩](README_en_Qabs.md)) | 中 ## 紹介 -HMCLはオープンソースでクロスプラットフォーム対応のMinecraftランチャーです。Mod管理、ゲームカスタマイズ、Modローダーのインストール(Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Quilt、LiteLoader、OptiFine)、Modパック作成、UIカスタマイズなど、さまざまな機能をサポートしています。 +HMCLはオープンソースでクロスプラットフォーム対応のMinecraftランチャーです。Mod管理、ゲームカスタマイズ、Modローダーのインストール(Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Ornithe、 Quilt、LiteLoader、OptiFine)、Modパック作成、UIカスタマイズなど、さまざまな機能をサポートしています。 HMCLは優れたクロスプラットフォーム性能を持っています。Windows、Linux、macOS、FreeBSDなどの異なるオペレーティングシステムだけでなく、x86、ARM、RISC-V、MIPS、LoongArchなどのさまざまなCPUアーキテクチャにも対応しています。HMCLを使えば、さまざまなプラットフォームでMinecraftを簡単に楽しむことができます。 diff --git a/docs/README_lzh.md b/docs/README_lzh.md index e490dee194..845abfcfb6 100644 --- a/docs/README_lzh.md +++ b/docs/README_lzh.md @@ -30,7 +30,7 @@ English ([Standard](README.md), [uʍoᗡ ǝpᴉsd∩](README_en_Qabs.md)) | ** ### 概敘 -HMCL 者,開源之礦藝啟器也。善理改囊,可自定遊戲,自動裝設 Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Quilt、LiteLoader、OptiFine 諸改囊,亦能制改囊集,界面隨心易之。 +HMCL 者,開源之礦藝啟器也。善理改囊,可自定遊戲,自動裝設 Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Ornithe、 Quilt、LiteLoader、OptiFine 諸改囊,亦能制改囊集,界面隨心易之。 HMCL 跨域廣矣。Windows、Linux、macOS、FreeBSD 諸常見械綱,x86、ARM、RISC-V、MIPS、LoongArch 諸算器架構,皆可運行。 憑此器,可遊《礦藝》於諸機之間,無礙也。 diff --git a/docs/README_ru.md b/docs/README_ru.md index 762eb4922f..07abd5f41a 100644 --- a/docs/README_ru.md +++ b/docs/README_ru.md @@ -30,7 +30,7 @@ English ([Standard](README.md), [uʍoᗡ ǝpᴉsd∩](README_en_Qabs.md)) | 中 ## Введение -HMCL — это открытый, кроссплатформенный лаунчер для Minecraft с поддержкой управления модами, настройки игры, установки загрузчиков модов (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Quilt, LiteLoader и OptiFine), создания модпаков, настройки интерфейса и многого другого. +HMCL — это открытый, кроссплатформенный лаунчер для Minecraft с поддержкой управления модами, настройки игры, установки загрузчиков модов (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Ornithe, Quilt, LiteLoader и OptiFine), создания модпаков, настройки интерфейса и многого другого. HMCL обладает отличной кроссплатформенностью. Он работает не только на различных операционных системах, таких как Windows, Linux, macOS и FreeBSD, но и поддерживает различные архитектуры процессоров: x86, ARM, RISC-V, MIPS и LoongArch. Благодаря HMCL вы можете легко наслаждаться Minecraft на разных платформах. diff --git a/docs/README_uk.md b/docs/README_uk.md index 39d0d517a1..7b6398a935 100644 --- a/docs/README_uk.md +++ b/docs/README_uk.md @@ -30,7 +30,7 @@ English ([Standard](README.md), [uʍoᗡ ǝpᴉsd∩](README_en_Qabs.md)) | 中 ## Вступ -HMCL — це відкритий, кросплатформний лаунчер для Minecraft, який підтримує керування модами, налаштування гри, встановлення модлоадерів (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Quilt, LiteLoader та OptiFine), створення модпаків, налаштування інтерфейсу та багато іншого. +HMCL — це відкритий, кросплатформний лаунчер для Minecraft, який підтримує керування модами, налаштування гри, встановлення модлоадерів (Forge, NeoForge, Cleanroom, Fabric, Legacy Fabric, Ornithe, Quilt, LiteLoader та OptiFine), створення модпаків, налаштування інтерфейсу та багато іншого. HMCL має чудові кросплатформні можливості. Він працює не лише на різних операційних системах, таких як Windows, Linux, macOS і FreeBSD, а й підтримує різні архітектури процесорів, такі як x86, ARM, RISC-V, MIPS і LoongArch. Ви можете легко насолоджуватися Minecraft на різних платформах за допомогою HMCL. diff --git a/docs/README_zh.md b/docs/README_zh.md index 57cf1bb745..0282b437bb 100644 --- a/docs/README_zh.md +++ b/docs/README_zh.md @@ -30,7 +30,7 @@ English ([Standard](README.md), [uʍoᗡ ǝpᴉsd∩](README_en_Qabs.md)) | ** ## 简介 -HMCL 是一款开源、跨平台的 Minecraft 启动器,支持模组管理、游戏自定义、游戏自动安装 (Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Quilt、LiteLoader 和 OptiFine)、整合包创建、界面自定义等功能。 +HMCL 是一款开源、跨平台的 Minecraft 启动器,支持模组管理、游戏自定义、游戏自动安装 (Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Ornithe、 Quilt、LiteLoader 和 OptiFine)、整合包创建、界面自定义等功能。 HMCL 有着强大的跨平台能力。它不仅支持 Windows、Linux、macOS、FreeBSD 等常见的操作系统,同时也支持 x86、ARM、RISC-V、MIPS、LoongArch 等不同的 CPU 架构。你可以使用 HMCL 在不同平台上轻松地游玩 Minecraft。 diff --git a/docs/README_zh_Hant.md b/docs/README_zh_Hant.md index 59d0b0b638..3111b4c4b0 100644 --- a/docs/README_zh_Hant.md +++ b/docs/README_zh_Hant.md @@ -30,7 +30,7 @@ English ([Standard](README.md), [uʍoᗡ ǝpᴉsd∩](README_en_Qabs.md)) | ** ## 簡介 -HMCL 是一款開源、跨平臺的 Minecraft 啟動器,支援模組管理、遊戲客製化、遊戲自動安裝 (Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Quilt、LiteLoader 和 OptiFine)、模組包建立、介面客製化等功能。 +HMCL 是一款開源、跨平臺的 Minecraft 啟動器,支援模組管理、遊戲客製化、遊戲自動安裝 (Forge、NeoForge、Cleanroom、Fabric、Legacy Fabric、Ornithe、 Quilt、LiteLoader 和 OptiFine)、模組包建立、介面客製化等功能。 HMCL 有著強大的跨平臺能力。它不僅支援 Windows、Linux、macOS、FreeBSD 等常見的作業系統,同時也支援 x86、ARM、RISC-V、MIPS、LoongArch 等不同的 CPU 架構。你可以使用 HMCL 在不同平臺上輕鬆地遊玩 Minecraft。