feat(download): quilt installation.
This commit is contained in:
@@ -592,21 +592,14 @@ public final class LauncherHelper {
|
|||||||
private static CompletableFuture<JavaVersion> downloadJavaImpl(GameJavaVersion javaVersion, DownloadProvider downloadProvider) {
|
private static CompletableFuture<JavaVersion> downloadJavaImpl(GameJavaVersion javaVersion, DownloadProvider downloadProvider) {
|
||||||
CompletableFuture<JavaVersion> future = new CompletableFuture<>();
|
CompletableFuture<JavaVersion> future = new CompletableFuture<>();
|
||||||
|
|
||||||
TaskExecutorDialogPane javaDownloadingPane = new TaskExecutorDialogPane(TaskCancellationAction.NORMAL);
|
Controllers.taskDialog(JavaRepository.downloadJava(javaVersion, downloadProvider)
|
||||||
|
|
||||||
TaskExecutor executor = JavaRepository.downloadJava(javaVersion, downloadProvider)
|
|
||||||
.whenComplete(Schedulers.javafx(), (downloadedJava, exception) -> {
|
.whenComplete(Schedulers.javafx(), (downloadedJava, exception) -> {
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
future.completeExceptionally(exception);
|
future.completeExceptionally(exception);
|
||||||
} else {
|
} else {
|
||||||
future.complete(downloadedJava);
|
future.complete(downloadedJava);
|
||||||
}
|
}
|
||||||
})
|
}), i18n("download.java"), TaskCancellationAction.NORMAL);
|
||||||
.executor(false);
|
|
||||||
|
|
||||||
javaDownloadingPane.setExecutor(executor, true);
|
|
||||||
Controllers.dialog(javaDownloadingPane);
|
|
||||||
executor.start();
|
|
||||||
|
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ public class InstallerItem extends Control {
|
|||||||
case "optifine":
|
case "optifine":
|
||||||
imageUrl = "/assets/img/command.png";
|
imageUrl = "/assets/img/command.png";
|
||||||
break;
|
break;
|
||||||
|
case "quilt":
|
||||||
|
case "quilt-api":
|
||||||
|
imageUrl = "/assets/img/quilt.png";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
imageUrl = null;
|
imageUrl = null;
|
||||||
break;
|
break;
|
||||||
@@ -111,40 +115,63 @@ public class InstallerItem extends Control {
|
|||||||
public final InstallerItem forge = new InstallerItem(FORGE);
|
public final InstallerItem forge = new InstallerItem(FORGE);
|
||||||
public final InstallerItem liteLoader = new InstallerItem(LITELOADER);
|
public final InstallerItem liteLoader = new InstallerItem(LITELOADER);
|
||||||
public final InstallerItem optiFine = new InstallerItem(OPTIFINE);
|
public final InstallerItem optiFine = new InstallerItem(OPTIFINE);
|
||||||
|
public final InstallerItem quilt = new InstallerItem(QUILT);
|
||||||
|
public final InstallerItem quiltApi = new InstallerItem(QUILT_API);
|
||||||
|
|
||||||
public InstallerItemGroup() {
|
public InstallerItemGroup() {
|
||||||
forge.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
forge.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
||||||
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
|
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
|
||||||
|
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
|
||||||
return null;
|
return null;
|
||||||
}, fabric.libraryVersion));
|
}, fabric.libraryVersion, quilt.libraryVersion));
|
||||||
|
|
||||||
liteLoader.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
liteLoader.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
||||||
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
|
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
|
||||||
|
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
|
||||||
return null;
|
return null;
|
||||||
}, fabric.libraryVersion));
|
}, fabric.libraryVersion, quilt.libraryVersion));
|
||||||
|
|
||||||
optiFine.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
optiFine.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
||||||
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
|
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
|
||||||
|
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
|
||||||
return null;
|
return null;
|
||||||
}, fabric.libraryVersion));
|
}, fabric.libraryVersion, quilt.libraryVersion));
|
||||||
|
|
||||||
for (InstallerItem fabric : new InstallerItem[]{fabric, fabricApi}) {
|
for (InstallerItem fabric : new InstallerItem[]{fabric, fabricApi}) {
|
||||||
fabric.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
fabric.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
||||||
|
if (forge.libraryVersion.get() != null) return FORGE.getPatchId();
|
||||||
if (liteLoader.libraryVersion.get() != null) return LITELOADER.getPatchId();
|
if (liteLoader.libraryVersion.get() != null) return LITELOADER.getPatchId();
|
||||||
if (optiFine.libraryVersion.get() != null) return OPTIFINE.getPatchId();
|
if (optiFine.libraryVersion.get() != null) return OPTIFINE.getPatchId();
|
||||||
if (forge.libraryVersion.get() != null) return FORGE.getPatchId();
|
if (quilt.libraryVersion.get() != null) return QUILT.getPatchId();
|
||||||
|
if (quiltApi.libraryVersion.get() != null) return QUILT_API.getPatchId();
|
||||||
return null;
|
return null;
|
||||||
}, optiFine.libraryVersion, forge.libraryVersion));
|
}, forge.libraryVersion, liteLoader.libraryVersion, optiFine.libraryVersion, quilt.libraryVersion, quiltApi.libraryVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
fabricApi.dependencyName.bind(Bindings.createStringBinding(() -> {
|
fabricApi.dependencyName.bind(Bindings.createStringBinding(() -> {
|
||||||
if (fabric.libraryVersion.get() == null) return FABRIC.getPatchId();
|
if (fabric.libraryVersion.get() == null) return FABRIC.getPatchId();
|
||||||
else return null;
|
else return null;
|
||||||
}, fabric.libraryVersion));
|
}, fabric.libraryVersion));
|
||||||
|
|
||||||
|
for (InstallerItem quilt : new InstallerItem[]{quilt, quiltApi}) {
|
||||||
|
quilt.incompatibleLibraryName.bind(Bindings.createStringBinding(() -> {
|
||||||
|
if (fabric.libraryVersion.get() != null) return FABRIC.getPatchId();
|
||||||
|
if (fabricApi.libraryVersion.get() != null) return FABRIC_API.getPatchId();
|
||||||
|
if (forge.libraryVersion.get() != null) return FORGE.getPatchId();
|
||||||
|
if (liteLoader.libraryVersion.get() != null) return LITELOADER.getPatchId();
|
||||||
|
if (optiFine.libraryVersion.get() != null) return OPTIFINE.getPatchId();
|
||||||
|
return null;
|
||||||
|
}, fabric.libraryVersion, fabricApi.libraryVersion, forge.libraryVersion, liteLoader.libraryVersion, optiFine.libraryVersion));
|
||||||
|
}
|
||||||
|
|
||||||
|
quiltApi.dependencyName.bind(Bindings.createStringBinding(() -> {
|
||||||
|
if (quilt.libraryVersion.get() == null) return QUILT.getPatchId();
|
||||||
|
else return null;
|
||||||
|
}, quilt.libraryVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
public InstallerItem[] getLibraries() {
|
public InstallerItem[] getLibraries() {
|
||||||
return new InstallerItem[]{game, forge, liteLoader, optiFine, fabric, fabricApi};
|
return new InstallerItem[]{game, forge, liteLoader, optiFine, fabric, fabricApi, quilt, quiltApi};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import org.jackhuang.hmcl.download.forge.ForgeNewInstallTask;
|
|||||||
import org.jackhuang.hmcl.download.forge.ForgeOldInstallTask;
|
import org.jackhuang.hmcl.download.forge.ForgeOldInstallTask;
|
||||||
import org.jackhuang.hmcl.download.game.GameAssetDownloadTask;
|
import org.jackhuang.hmcl.download.game.GameAssetDownloadTask;
|
||||||
import org.jackhuang.hmcl.download.game.GameInstallTask;
|
import org.jackhuang.hmcl.download.game.GameInstallTask;
|
||||||
|
import org.jackhuang.hmcl.download.java.JavaDownloadTask;
|
||||||
import org.jackhuang.hmcl.download.liteloader.LiteLoaderInstallTask;
|
import org.jackhuang.hmcl.download.liteloader.LiteLoaderInstallTask;
|
||||||
import org.jackhuang.hmcl.download.optifine.OptiFineInstallTask;
|
import org.jackhuang.hmcl.download.optifine.OptiFineInstallTask;
|
||||||
import org.jackhuang.hmcl.game.HMCLModpackInstallTask;
|
import org.jackhuang.hmcl.game.HMCLModpackInstallTask;
|
||||||
@@ -148,6 +149,8 @@ public final class TaskListPane extends StackPane {
|
|||||||
task.setName(i18n("modpack.export"));
|
task.setName(i18n("modpack.export"));
|
||||||
} else if (task instanceof MinecraftInstanceTask) {
|
} else if (task instanceof MinecraftInstanceTask) {
|
||||||
task.setName(i18n("modpack.scan"));
|
task.setName(i18n("modpack.scan"));
|
||||||
|
} else if (task instanceof JavaDownloadTask) {
|
||||||
|
task.setName(i18n("download.java"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
@@ -243,6 +246,7 @@ public final class TaskListPane extends StackPane {
|
|||||||
case "hmcl.install.optifine": message = i18n("install.installer.install", i18n("install.installer.optifine") + " " + stageValue); break;
|
case "hmcl.install.optifine": message = i18n("install.installer.install", i18n("install.installer.optifine") + " " + stageValue); break;
|
||||||
case "hmcl.install.fabric": message = i18n("install.installer.install", i18n("install.installer.fabric") + " " + stageValue); break;
|
case "hmcl.install.fabric": message = i18n("install.installer.install", i18n("install.installer.fabric") + " " + stageValue); break;
|
||||||
case "hmcl.install.fabric-api": message = i18n("install.installer.install", i18n("install.installer.fabric-api") + " " + stageValue); break;
|
case "hmcl.install.fabric-api": message = i18n("install.installer.install", i18n("install.installer.fabric-api") + " " + stageValue); break;
|
||||||
|
case "hmcl.install.quilt": message = i18n("install.installer.install", i18n("install.installer.quilt") + " " + stageValue); break;
|
||||||
default: message = i18n(stageKey); break;
|
default: message = i18n(stageKey); break;
|
||||||
}
|
}
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|||||||
BIN
HMCL/src/main/resources/assets/img/quilt.png
Normal file
BIN
HMCL/src/main/resources/assets/img/quilt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -312,6 +312,7 @@ download.provider.mojang=Mojang (OptiFine is provided by BMCLAPI)
|
|||||||
download.provider.official=From Official Sources
|
download.provider.official=From Official Sources
|
||||||
download.provider.balanced=From Fastest Available
|
download.provider.balanced=From Fastest Available
|
||||||
download.provider.mirror=From Mirror
|
download.provider.mirror=From Mirror
|
||||||
|
download.java=Downloading Java
|
||||||
download.javafx=Downloading dependencies for launcher...
|
download.javafx=Downloading dependencies for launcher...
|
||||||
download.javafx.notes=We are currently downloading dependencies for HMCL from the Internet.\n\
|
download.javafx.notes=We are currently downloading dependencies for HMCL from the Internet.\n\
|
||||||
\n\
|
\n\
|
||||||
@@ -590,6 +591,7 @@ install.installer.install_online.tooltip=We currently support Fabric, Forge, Opt
|
|||||||
install.installer.liteloader=LiteLoader
|
install.installer.liteloader=LiteLoader
|
||||||
install.installer.not_installed=Not Selected
|
install.installer.not_installed=Not Selected
|
||||||
install.installer.optifine=OptiFine
|
install.installer.optifine=OptiFine
|
||||||
|
install.installer.quilt=Quilt
|
||||||
install.installer.version=%s
|
install.installer.version=%s
|
||||||
install.modpack=Install a Modpack
|
install.modpack=Install a Modpack
|
||||||
install.new_game=Add a New Instance
|
install.new_game=Add a New Instance
|
||||||
|
|||||||
@@ -588,6 +588,7 @@ install.installer.install_online.tooltip=Actualmente soportamos Fabric, Forge, O
|
|||||||
install.installer.liteloader=LiteLoader
|
install.installer.liteloader=LiteLoader
|
||||||
install.installer.not_installed=No seleccionado
|
install.installer.not_installed=No seleccionado
|
||||||
install.installer.optifine=OptiFine
|
install.installer.optifine=OptiFine
|
||||||
|
install.installer.quilt=Quilt
|
||||||
install.installer.version=%s
|
install.installer.version=%s
|
||||||
install.modpack=Instalar un Modpack
|
install.modpack=Instalar un Modpack
|
||||||
install.new_game=Añadir instancia
|
install.new_game=Añadir instancia
|
||||||
|
|||||||
@@ -444,6 +444,7 @@ install.installer.install_online.tooltip=Fabric、Forge、OptiFine、LiteLoader
|
|||||||
install.installer.liteloader=LiteLoader
|
install.installer.liteloader=LiteLoader
|
||||||
install.installer.not_installed=インストールされていません
|
install.installer.not_installed=インストールされていません
|
||||||
install.installer.optifine=OptiFine
|
install.installer.optifine=OptiFine
|
||||||
|
install.installer.quilt=Quilt
|
||||||
install.installer.version=%s
|
install.installer.version=%s
|
||||||
install.modpack=modpackを導入
|
install.modpack=modpackを導入
|
||||||
install.new_game=新規作成
|
install.new_game=新規作成
|
||||||
|
|||||||
@@ -446,6 +446,7 @@ install.installer.install_online.tooltip=Поддержка установки F
|
|||||||
install.installer.liteloader=LiteLoader
|
install.installer.liteloader=LiteLoader
|
||||||
install.installer.not_installed=Не установлен
|
install.installer.not_installed=Не установлен
|
||||||
install.installer.optifine=OptiFine
|
install.installer.optifine=OptiFine
|
||||||
|
install.installer.quilt=Quilt
|
||||||
install.installer.version=%s
|
install.installer.version=%s
|
||||||
install.modpack=Установить модпак
|
install.modpack=Установить модпак
|
||||||
install.new_game=Установить новую игру
|
install.new_game=Установить новую игру
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ download.provider.mojang=官方伺服器 (OptiFine 自動安裝的下載來源
|
|||||||
download.provider.official=儘量使用官方源(最新,但可能加載慢)
|
download.provider.official=儘量使用官方源(最新,但可能加載慢)
|
||||||
download.provider.balanced=選擇加載速度快的下載源(平衡,但可能不是最新)
|
download.provider.balanced=選擇加載速度快的下載源(平衡,但可能不是最新)
|
||||||
download.provider.mirror=儘量使用鏡像源(加載快,但可能不是最新)
|
download.provider.mirror=儘量使用鏡像源(加載快,但可能不是最新)
|
||||||
|
download.java=下載 Java
|
||||||
download.javafx=正在下載必要的運行時組件
|
download.javafx=正在下載必要的運行時組件
|
||||||
download.javafx.notes=正在通過網絡下載 HMCL 必要的運行時組件。\n點擊“切換下載源”按鈕查看詳情以及選擇下載源,點擊“取消”按鈕停止並退出。\n注意:如果下載速度過慢,請嘗試切换下載源。
|
download.javafx.notes=正在通過網絡下載 HMCL 必要的運行時組件。\n點擊“切換下載源”按鈕查看詳情以及選擇下載源,點擊“取消”按鈕停止並退出。\n注意:如果下載速度過慢,請嘗試切换下載源。
|
||||||
download.javafx.component=正在下載模塊 %s
|
download.javafx.component=正在下載模塊 %s
|
||||||
@@ -451,6 +452,7 @@ install.installer.install_online.tooltip=支援安裝 Fabric、Forge、OptiFine
|
|||||||
install.installer.liteloader=LiteLoader
|
install.installer.liteloader=LiteLoader
|
||||||
install.installer.not_installed=不安裝
|
install.installer.not_installed=不安裝
|
||||||
install.installer.optifine=OptiFine
|
install.installer.optifine=OptiFine
|
||||||
|
install.installer.quilt=Quilt
|
||||||
install.installer.version=%s
|
install.installer.version=%s
|
||||||
install.modpack=安裝模組包
|
install.modpack=安裝模組包
|
||||||
install.new_game=安裝新遊戲版本
|
install.new_game=安裝新遊戲版本
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ download.provider.mojang=官方(OptiFine 自动安装使用 BMCLAPI 下载源
|
|||||||
download.provider.official=尽量使用官方源(最新,但可能加载慢)
|
download.provider.official=尽量使用官方源(最新,但可能加载慢)
|
||||||
download.provider.balanced=选择加载速度快的下载源(平衡,但可能不是最新)
|
download.provider.balanced=选择加载速度快的下载源(平衡,但可能不是最新)
|
||||||
download.provider.mirror=尽量使用镜像源(加载快,但可能不是最新)
|
download.provider.mirror=尽量使用镜像源(加载快,但可能不是最新)
|
||||||
|
download.java=下载 Java
|
||||||
download.javafx=正在下载必要的运行时组件……
|
download.javafx=正在下载必要的运行时组件……
|
||||||
download.javafx.notes=正在通过网络下载 HMCL 必要的运行时组件。\n点击“切换下载源”按钮查看详情以及选择下载源,点击“取消”按钮停止并退出。\n注意:若下载速度过慢,请尝试切换下载源
|
download.javafx.notes=正在通过网络下载 HMCL 必要的运行时组件。\n点击“切换下载源”按钮查看详情以及选择下载源,点击“取消”按钮停止并退出。\n注意:若下载速度过慢,请尝试切换下载源
|
||||||
download.javafx.component=正在下载模块 %s
|
download.javafx.component=正在下载模块 %s
|
||||||
@@ -451,6 +452,7 @@ install.installer.install_online.tooltip=支持安装 Fabric、Forge、OptiFine
|
|||||||
install.installer.liteloader=LiteLoader
|
install.installer.liteloader=LiteLoader
|
||||||
install.installer.not_installed=不安装
|
install.installer.not_installed=不安装
|
||||||
install.installer.optifine=OptiFine
|
install.installer.optifine=OptiFine
|
||||||
|
install.installer.quilt=Quilt
|
||||||
install.installer.version=%s
|
install.installer.version=%s
|
||||||
install.modpack=安装整合包
|
install.modpack=安装整合包
|
||||||
install.new_game=安装新游戏版本
|
install.new_game=安装新游戏版本
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import org.jackhuang.hmcl.download.forge.ForgeBMCLVersionList;
|
|||||||
import org.jackhuang.hmcl.download.game.GameVersionList;
|
import org.jackhuang.hmcl.download.game.GameVersionList;
|
||||||
import org.jackhuang.hmcl.download.liteloader.LiteLoaderBMCLVersionList;
|
import org.jackhuang.hmcl.download.liteloader.LiteLoaderBMCLVersionList;
|
||||||
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
|
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
|
||||||
|
import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList;
|
||||||
|
import org.jackhuang.hmcl.download.quilt.QuiltVersionList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -33,20 +35,22 @@ public class BMCLAPIDownloadProvider implements DownloadProvider {
|
|||||||
private final GameVersionList game;
|
private final GameVersionList game;
|
||||||
private final FabricVersionList fabric;
|
private final FabricVersionList fabric;
|
||||||
private final FabricAPIVersionList fabricApi;
|
private final FabricAPIVersionList fabricApi;
|
||||||
private final QuiltVersionList quilt;
|
|
||||||
private final ForgeBMCLVersionList forge;
|
private final ForgeBMCLVersionList forge;
|
||||||
private final LiteLoaderBMCLVersionList liteLoader;
|
private final LiteLoaderBMCLVersionList liteLoader;
|
||||||
private final OptiFineBMCLVersionList optifine;
|
private final OptiFineBMCLVersionList optifine;
|
||||||
|
private final QuiltVersionList quilt;
|
||||||
|
private final QuiltAPIVersionList quiltApi;
|
||||||
|
|
||||||
public BMCLAPIDownloadProvider(String apiRoot) {
|
public BMCLAPIDownloadProvider(String apiRoot) {
|
||||||
this.apiRoot = apiRoot;
|
this.apiRoot = apiRoot;
|
||||||
this.game = new GameVersionList(this);
|
this.game = new GameVersionList(this);
|
||||||
this.fabric = new FabricVersionList(this);
|
this.fabric = new FabricVersionList(this);
|
||||||
this.fabricApi = new FabricAPIVersionList(this);
|
this.fabricApi = new FabricAPIVersionList(this);
|
||||||
this.quilt = new QuiltVersionList(this);
|
|
||||||
this.forge = new ForgeBMCLVersionList(apiRoot);
|
this.forge = new ForgeBMCLVersionList(apiRoot);
|
||||||
this.liteLoader = new LiteLoaderBMCLVersionList(this);
|
this.liteLoader = new LiteLoaderBMCLVersionList(this);
|
||||||
this.optifine = new OptiFineBMCLVersionList(apiRoot);
|
this.optifine = new OptiFineBMCLVersionList(apiRoot);
|
||||||
|
this.quilt = new QuiltVersionList(this);
|
||||||
|
this.quiltApi = new QuiltAPIVersionList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiRoot() {
|
public String getApiRoot() {
|
||||||
@@ -74,12 +78,14 @@ public class BMCLAPIDownloadProvider implements DownloadProvider {
|
|||||||
return fabricApi;
|
return fabricApi;
|
||||||
case "forge":
|
case "forge":
|
||||||
return forge;
|
return forge;
|
||||||
case "quilt":
|
|
||||||
return quilt;
|
|
||||||
case "liteloader":
|
case "liteloader":
|
||||||
return liteLoader;
|
return liteLoader;
|
||||||
case "optifine":
|
case "optifine":
|
||||||
return optifine;
|
return optifine;
|
||||||
|
case "quilt":
|
||||||
|
return quilt;
|
||||||
|
case "quilt-api":
|
||||||
|
return quiltApi;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unrecognized version list id: " + id);
|
throw new IllegalArgumentException("Unrecognized version list id: " + id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ public final class LibraryAnalyzer implements Iterable<LibraryAnalyzer.LibraryMa
|
|||||||
public enum LibraryType {
|
public enum LibraryType {
|
||||||
MINECRAFT(true, "game", Pattern.compile("^$"), Pattern.compile("^$")),
|
MINECRAFT(true, "game", Pattern.compile("^$"), Pattern.compile("^$")),
|
||||||
FABRIC(true, "fabric", Pattern.compile("net\\.fabricmc"), Pattern.compile("fabric-loader")),
|
FABRIC(true, "fabric", Pattern.compile("net\\.fabricmc"), Pattern.compile("fabric-loader")),
|
||||||
QUILT(true, "quilt", Pattern.compile("org\\.quiltmc"), Pattern.compile("quilt-loader")),
|
|
||||||
FABRIC_API(true, "fabric-api", Pattern.compile("net\\.fabricmc"), Pattern.compile("fabric-api")),
|
FABRIC_API(true, "fabric-api", Pattern.compile("net\\.fabricmc"), Pattern.compile("fabric-api")),
|
||||||
FORGE(true, "forge", Pattern.compile("net\\.minecraftforge"), Pattern.compile("(forge|fmlloader)")) {
|
FORGE(true, "forge", Pattern.compile("net\\.minecraftforge"), Pattern.compile("(forge|fmlloader)")) {
|
||||||
private final Pattern FORGE_VERSION_MATCHER = Pattern.compile("^([0-9.]+)-(?<forge>[0-9.]+)(-([0-9.]+))?$");
|
private final Pattern FORGE_VERSION_MATCHER = Pattern.compile("^([0-9.]+)-(?<forge>[0-9.]+)(-([0-9.]+))?$");
|
||||||
@@ -177,6 +176,8 @@ public final class LibraryAnalyzer implements Iterable<LibraryAnalyzer.LibraryMa
|
|||||||
},
|
},
|
||||||
LITELOADER(true, "liteloader", Pattern.compile("com\\.mumfrey"), Pattern.compile("liteloader")),
|
LITELOADER(true, "liteloader", Pattern.compile("com\\.mumfrey"), Pattern.compile("liteloader")),
|
||||||
OPTIFINE(false, "optifine", Pattern.compile("(net\\.)?optifine"), Pattern.compile("^(?!.*launchwrapper).*$")),
|
OPTIFINE(false, "optifine", Pattern.compile("(net\\.)?optifine"), Pattern.compile("^(?!.*launchwrapper).*$")),
|
||||||
|
QUILT(true, "quilt", Pattern.compile("org\\.quiltmc"), Pattern.compile("quilt-loader")),
|
||||||
|
QUILT_API(true, "quilt-api", Pattern.compile("org\\.quiltmc"), Pattern.compile("quilt-api")),
|
||||||
BOOTSTRAP_LAUNCHER(false, "", Pattern.compile("cpw\\.mods"), Pattern.compile("bootstraplauncher"));
|
BOOTSTRAP_LAUNCHER(false, "", Pattern.compile("cpw\\.mods"), Pattern.compile("bootstraplauncher"));
|
||||||
|
|
||||||
private final boolean modLoader;
|
private final boolean modLoader;
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import org.jackhuang.hmcl.download.forge.ForgeBMCLVersionList;
|
|||||||
import org.jackhuang.hmcl.download.game.GameVersionList;
|
import org.jackhuang.hmcl.download.game.GameVersionList;
|
||||||
import org.jackhuang.hmcl.download.liteloader.LiteLoaderVersionList;
|
import org.jackhuang.hmcl.download.liteloader.LiteLoaderVersionList;
|
||||||
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
|
import org.jackhuang.hmcl.download.optifine.OptiFineBMCLVersionList;
|
||||||
|
import org.jackhuang.hmcl.download.quilt.QuiltAPIVersionList;
|
||||||
|
import org.jackhuang.hmcl.download.quilt.QuiltVersionList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see <a href="http://wiki.vg">http://wiki.vg</a>
|
* @see <a href="http://wiki.vg">http://wiki.vg</a>
|
||||||
@@ -35,6 +37,8 @@ public class MojangDownloadProvider implements DownloadProvider {
|
|||||||
private final ForgeBMCLVersionList forge;
|
private final ForgeBMCLVersionList forge;
|
||||||
private final LiteLoaderVersionList liteLoader;
|
private final LiteLoaderVersionList liteLoader;
|
||||||
private final OptiFineBMCLVersionList optifine;
|
private final OptiFineBMCLVersionList optifine;
|
||||||
|
private final QuiltVersionList quilt;
|
||||||
|
private final QuiltAPIVersionList quiltApi;
|
||||||
|
|
||||||
public MojangDownloadProvider() {
|
public MojangDownloadProvider() {
|
||||||
String apiRoot = "https://bmclapi2.bangbang93.com";
|
String apiRoot = "https://bmclapi2.bangbang93.com";
|
||||||
@@ -45,6 +49,8 @@ public class MojangDownloadProvider implements DownloadProvider {
|
|||||||
this.forge = new ForgeBMCLVersionList(apiRoot);
|
this.forge = new ForgeBMCLVersionList(apiRoot);
|
||||||
this.liteLoader = new LiteLoaderVersionList(this);
|
this.liteLoader = new LiteLoaderVersionList(this);
|
||||||
this.optifine = new OptiFineBMCLVersionList(apiRoot);
|
this.optifine = new OptiFineBMCLVersionList(apiRoot);
|
||||||
|
this.quilt = new QuiltVersionList(this);
|
||||||
|
this.quiltApi = new QuiltAPIVersionList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,6 +78,10 @@ public class MojangDownloadProvider implements DownloadProvider {
|
|||||||
return liteLoader;
|
return liteLoader;
|
||||||
case "optifine":
|
case "optifine":
|
||||||
return optifine;
|
return optifine;
|
||||||
|
case "quilt":
|
||||||
|
return quilt;
|
||||||
|
case "quilt-api":
|
||||||
|
return quiltApi;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unrecognized version list id: " + id);
|
throw new IllegalArgumentException("Unrecognized version list id: " + id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class JavaDownloadTask extends Task<Void> {
|
|||||||
RemoteFiles.RemoteFile file = ((RemoteFiles.RemoteFile) entry.getValue());
|
RemoteFiles.RemoteFile file = ((RemoteFiles.RemoteFile) entry.getValue());
|
||||||
if (file.getDownloads().containsKey("lzma")) {
|
if (file.getDownloads().containsKey("lzma")) {
|
||||||
DownloadInfo download = file.getDownloads().get("lzma");
|
DownloadInfo download = file.getDownloads().get("lzma");
|
||||||
File tempFile = Files.createTempFile("hmcl", "tmp").toFile();
|
File tempFile = jvmDir.resolve(entry.getKey() + ".lzma").toFile();
|
||||||
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(download.getUrl()), tempFile, new FileDownloadTask.IntegrityCheck("SHA-1", download.getSha1()));
|
FileDownloadTask task = new FileDownloadTask(NetworkUtils.toURL(download.getUrl()), tempFile, new FileDownloadTask.IntegrityCheck("SHA-1", download.getSha1()));
|
||||||
task.setName(entry.getKey());
|
task.setName(entry.getKey());
|
||||||
dependencies.add(task.thenRunAsync(() -> {
|
dependencies.add(task.thenRunAsync(() -> {
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher
|
||||||
|
* Copyright (C) 2021 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hmcl.download.quilt;
|
||||||
|
|
||||||
|
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.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b>Note</b>: Quilt should be installed first.
|
||||||
|
*
|
||||||
|
* @author huangyuhui
|
||||||
|
*/
|
||||||
|
public final class QuiltAPIInstallTask extends Task<Version> {
|
||||||
|
|
||||||
|
private final DefaultDependencyManager dependencyManager;
|
||||||
|
private final Version version;
|
||||||
|
private final QuiltAPIRemoteVersion remote;
|
||||||
|
private final List<Task<?>> dependencies = new ArrayList<>(1);
|
||||||
|
|
||||||
|
public QuiltAPIInstallTask(DefaultDependencyManager dependencyManager, Version version, QuiltAPIRemoteVersion remoteVersion) {
|
||||||
|
this.dependencyManager = dependencyManager;
|
||||||
|
this.version = version;
|
||||||
|
this.remote = remoteVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Task<?>> getDependencies() {
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRelyingOnDependencies() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws IOException {
|
||||||
|
dependencies.add(new FileDownloadTask(
|
||||||
|
new URL(remote.getVersion().getFile().getUrl()),
|
||||||
|
dependencyManager.getGameRepository().getRunDirectory(version.getId()).toPath().resolve("mods").resolve("quilt-api-" + remote.getVersion().getVersion() + ".jar").toFile(),
|
||||||
|
remote.getVersion().getFile().getIntegrityCheck())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher
|
||||||
|
* Copyright (C) 2021 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hmcl.download.quilt;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.download.DefaultDependencyManager;
|
||||||
|
import org.jackhuang.hmcl.download.LibraryAnalyzer;
|
||||||
|
import org.jackhuang.hmcl.download.RemoteVersion;
|
||||||
|
import org.jackhuang.hmcl.download.fabric.FabricAPIInstallTask;
|
||||||
|
import org.jackhuang.hmcl.game.Version;
|
||||||
|
import org.jackhuang.hmcl.mod.RemoteMod;
|
||||||
|
import org.jackhuang.hmcl.task.Task;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class QuiltAPIRemoteVersion 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.
|
||||||
|
*/
|
||||||
|
QuiltAPIRemoteVersion(String gameVersion, String selfVersion, String fullVersion, Date datePublished, RemoteMod.Version version, List<String> urls) {
|
||||||
|
super(LibraryAnalyzer.LibraryType.QUILT_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<Version> getInstallTask(DefaultDependencyManager dependencyManager, Version baseVersion) {
|
||||||
|
return new QuiltAPIInstallTask(dependencyManager, baseVersion, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(RemoteVersion o) {
|
||||||
|
if (!(o instanceof QuiltAPIRemoteVersion)) return 0;
|
||||||
|
return -this.getReleaseDate().compareTo(o.getReleaseDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher
|
||||||
|
* Copyright (C) 2021 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hmcl.download.quilt;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.download.DownloadProvider;
|
||||||
|
import org.jackhuang.hmcl.download.VersionList;
|
||||||
|
import org.jackhuang.hmcl.download.fabric.FabricAPIRemoteVersion;
|
||||||
|
import org.jackhuang.hmcl.mod.RemoteMod;
|
||||||
|
import org.jackhuang.hmcl.mod.modrinth.ModrinthRemoteModRepository;
|
||||||
|
import org.jackhuang.hmcl.util.Lang;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import static org.jackhuang.hmcl.util.Lang.wrap;
|
||||||
|
|
||||||
|
public class QuiltAPIVersionList extends VersionList<QuiltAPIRemoteVersion> {
|
||||||
|
|
||||||
|
private final DownloadProvider downloadProvider;
|
||||||
|
|
||||||
|
public QuiltAPIVersionList(DownloadProvider downloadProvider) {
|
||||||
|
this.downloadProvider = downloadProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasType() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<?> refreshAsync() {
|
||||||
|
return CompletableFuture.runAsync(wrap(() -> {
|
||||||
|
for (RemoteMod.Version modVersion : Lang.toIterable(ModrinthRemoteModRepository.MODS.getRemoteVersionsById("qsl"))) {
|
||||||
|
for (String gameVersion : modVersion.getGameVersions()) {
|
||||||
|
versions.put(gameVersion, new QuiltAPIRemoteVersion(gameVersion, modVersion.getVersion(), modVersion.getName(), modVersion.getDatePublished(), modVersion,
|
||||||
|
Collections.singletonList(modVersion.getFile().getUrl())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,13 +85,13 @@ public final class QuiltInstallTask extends Task<Version> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
setResult(getPatch(JsonUtils.GSON.fromJson(launchMetaTask.getResult(), FabricInfo.class), remote.getGameVersion(), remote.getSelfVersion()));
|
setResult(getPatch(JsonUtils.GSON.fromJson(launchMetaTask.getResult(), QuiltInfo.class), remote.getGameVersion(), remote.getSelfVersion()));
|
||||||
|
|
||||||
dependencies.add(dependencyManager.checkLibraryCompletionAsync(getResult(), true));
|
dependencies.add(dependencyManager.checkLibraryCompletionAsync(getResult(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Version getPatch(FabricInfo fabricInfo, String gameVersion, String loaderVersion) {
|
private Version getPatch(QuiltInfo quiltInfo, String gameVersion, String loaderVersion) {
|
||||||
JsonObject launcherMeta = fabricInfo.launcherMeta;
|
JsonObject launcherMeta = quiltInfo.launcherMeta;
|
||||||
Arguments arguments = new Arguments();
|
Arguments arguments = new Arguments();
|
||||||
|
|
||||||
String mainClass;
|
String mainClass;
|
||||||
@@ -117,19 +117,34 @@ public final class QuiltInstallTask extends Task<Version> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libraries.add(new Library(Artifact.fromDescriptor(fabricInfo.intermediary.maven), "https://maven.fabricmc.net/", null));
|
libraries.add(new Library(Artifact.fromDescriptor(quiltInfo.hashed.maven), getMavenRepositoryByGroup(quiltInfo.hashed.maven), null));
|
||||||
libraries.add(new Library(Artifact.fromDescriptor(fabricInfo.loader.maven), "https://maven.fabricmc.net/", null));
|
libraries.add(new Library(Artifact.fromDescriptor(quiltInfo.intermediary.maven), getMavenRepositoryByGroup(quiltInfo.intermediary.maven), null));
|
||||||
|
libraries.add(new Library(Artifact.fromDescriptor(quiltInfo.loader.maven), getMavenRepositoryByGroup(quiltInfo.loader.maven), null));
|
||||||
|
|
||||||
return new Version(LibraryAnalyzer.LibraryType.FABRIC.getPatchId(), loaderVersion, 30000, arguments, mainClass, libraries);
|
return new Version(LibraryAnalyzer.LibraryType.QUILT.getPatchId(), loaderVersion, 30000, arguments, mainClass, libraries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FabricInfo {
|
private static String getMavenRepositoryByGroup(String maven) {
|
||||||
|
Artifact artifact = Artifact.fromDescriptor(maven);
|
||||||
|
switch (artifact.getGroup()) {
|
||||||
|
case "net.fabricmc":
|
||||||
|
return "https://maven.fabricmc.net/";
|
||||||
|
case "org.quiltmc":
|
||||||
|
return "https://maven.quiltmc.org/repository/release/";
|
||||||
|
default:
|
||||||
|
return "https://maven.fabricmc.net/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class QuiltInfo {
|
||||||
private final LoaderInfo loader;
|
private final LoaderInfo loader;
|
||||||
private final IntermediaryInfo hashed;
|
private final IntermediaryInfo hashed;
|
||||||
|
private final IntermediaryInfo intermediary;
|
||||||
private final JsonObject launcherMeta;
|
private final JsonObject launcherMeta;
|
||||||
|
|
||||||
public FabricInfo(LoaderInfo loader, IntermediaryInfo intermediary, JsonObject launcherMeta) {
|
public QuiltInfo(LoaderInfo loader, IntermediaryInfo hashed, IntermediaryInfo intermediary, JsonObject launcherMeta) {
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
|
this.hashed = hashed;
|
||||||
this.intermediary = intermediary;
|
this.intermediary = intermediary;
|
||||||
this.launcherMeta = launcherMeta;
|
this.launcherMeta = launcherMeta;
|
||||||
}
|
}
|
||||||
@@ -138,6 +153,10 @@ public final class QuiltInstallTask extends Task<Version> {
|
|||||||
return loader;
|
return loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IntermediaryInfo getHashed() {
|
||||||
|
return hashed;
|
||||||
|
}
|
||||||
|
|
||||||
public IntermediaryInfo getIntermediary() {
|
public IntermediaryInfo getIntermediary() {
|
||||||
return intermediary;
|
return intermediary;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class QuiltRemoteVersion extends RemoteVersion {
|
|||||||
* @param urls the installer or universal jar original URL.
|
* @param urls the installer or universal jar original URL.
|
||||||
*/
|
*/
|
||||||
QuiltRemoteVersion(String gameVersion, String selfVersion, List<String> urls) {
|
QuiltRemoteVersion(String gameVersion, String selfVersion, List<String> urls) {
|
||||||
super(LibraryAnalyzer.LibraryType.FABRIC.getPatchId(), gameVersion, selfVersion, null, urls);
|
super(LibraryAnalyzer.LibraryType.QUILT.getPatchId(), gameVersion, selfVersion, null, urls);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user