mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-19 00:36:10 -04:00
[Fix 2378] Invalid Modrinth Mod ID 错误的 Modrinth Mod ID (#2385)
* Upgrade timeout to 30s * Fix #2378 * Revert "Upgrade timeout to 30s" This reverts commit 366a9dd34b7d2706d3a6ec42398c0c9ba43af4f8.
This commit is contained in:
parent
83120afb63
commit
61165dd71d
@ -26,6 +26,8 @@ import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.DataFormat;
|
||||
import javafx.stage.Stage;
|
||||
import org.jackhuang.hmcl.auth.offline.Skin;
|
||||
import org.jackhuang.hmcl.mod.RemoteMod;
|
||||
import org.jackhuang.hmcl.mod.RemoteModRepository;
|
||||
import org.jackhuang.hmcl.setting.ConfigHolder;
|
||||
import org.jackhuang.hmcl.setting.SambaException;
|
||||
import org.jackhuang.hmcl.task.AsyncTaskExecutor;
|
||||
@ -51,8 +53,10 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.jackhuang.hmcl.ui.FXUtils.runInFX;
|
||||
import static org.jackhuang.hmcl.util.Logging.LOG;
|
||||
@ -92,6 +96,18 @@ public final class Launcher extends Application {
|
||||
}
|
||||
});
|
||||
|
||||
RemoteMod.registerEmptyRemoteMod(new RemoteMod("", "", i18n("mods.broken_dependency.title"), i18n("mods.broken_dependency.desc"), new ArrayList<>(), "", "/assets/img/icon.png", new RemoteMod.IMod() {
|
||||
@Override
|
||||
public List<RemoteMod> loadDependencies(RemoteModRepository modRepository) throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<RemoteMod.Version> loadVersions(RemoteModRepository modRepository) throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
}));
|
||||
|
||||
LOG.info("JavaFX Version: " + System.getProperty("javafx.runtime.version"));
|
||||
try {
|
||||
Object pipeline = Class.forName("com.sun.prism.GraphicsPipeline").getMethod("getPipeline").invoke(null);
|
||||
|
@ -127,7 +127,7 @@ public class DownloadPage extends DecoratorAnimatedPage implements DecoratorPage
|
||||
item.setTitle(i18n("resourcepack"));
|
||||
item.setLeftGraphic(wrap(SVG::textureBox));
|
||||
item.activeProperty().bind(tab.getSelectionModel().selectedItemProperty().isEqualTo(resourcePackTab));
|
||||
item.setOnAction(e -> selectTabIfCurseForgeAvailable(resourcePackTab));
|
||||
item.setOnAction(e -> tab.select(resourcePackTab));
|
||||
})
|
||||
// .addNavigationDrawerItem(item -> {
|
||||
// item.setTitle(i18n("download.curseforge.customization"));
|
||||
|
@ -855,6 +855,8 @@ mods=Mods
|
||||
mods.add=Add Mods
|
||||
mods.add.failed=Failed to install mod %s.
|
||||
mods.add.success=%s was installed successfully.
|
||||
mods.broken_dependency.title=Broken dependency
|
||||
mods.broken_dependency.desc=This dependency existed before. However, it doesn't exist now. Try using another download source.
|
||||
mods.category=Category
|
||||
mods.check_updates=Check for Updates
|
||||
mods.check_updates.current_version=Current Version
|
||||
|
@ -728,6 +728,8 @@ mods=模組
|
||||
mods.add=新增模組
|
||||
mods.add.failed=新增模組 %s 失敗。
|
||||
mods.add.success=成功新增模組 %s。
|
||||
mods.broken_dependency.title=損壞前置模組
|
||||
mods.broken_dependency.desc=該前置模組曾經在該模組倉庫上存在過,但現在被刪除了。換個下載源試試吧。
|
||||
mods.category=類別
|
||||
mods.check_updates=檢查模組更新
|
||||
mods.check_updates.current_version=當前版本
|
||||
|
@ -728,6 +728,8 @@ mods=模组
|
||||
mods.add=添加模组
|
||||
mods.add.failed=添加模组 %s 失败。
|
||||
mods.add.success=成功添加模组 %s。
|
||||
mods.broken_dependency.title=损坏前置模组
|
||||
mods.broken_dependency.desc=该前置模组曾经在该模组仓库上存在过,但现在被删除了。换个下载源试试吧。
|
||||
mods.category=类别
|
||||
mods.check_updates=检查模组更新
|
||||
mods.check_updates.current_version=当前版本
|
||||
|
@ -30,6 +30,19 @@ import java.util.stream.Stream;
|
||||
import static org.jackhuang.hmcl.util.io.NetworkUtils.encodeLocation;
|
||||
|
||||
public class RemoteMod {
|
||||
private static RemoteMod EMPTY = null;
|
||||
|
||||
public static void registerEmptyRemoteMod(RemoteMod empty) {
|
||||
EMPTY = empty;
|
||||
}
|
||||
|
||||
public static RemoteMod getEmptyRemoteMod() {
|
||||
if (EMPTY == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
private final String slug;
|
||||
private final String author;
|
||||
private final String title;
|
||||
|
@ -291,6 +291,9 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
|
||||
.collect(Collectors.toSet());
|
||||
List<RemoteMod> mods = new ArrayList<>();
|
||||
for (String dependencyId : dependencies) {
|
||||
if (dependencyId == null) {
|
||||
mods.add(RemoteMod.getEmptyRemoteMod());
|
||||
}
|
||||
if (StringUtils.isNotBlank(dependencyId)) {
|
||||
mods.add(modRepository.getModById(dependencyId));
|
||||
}
|
||||
@ -493,7 +496,7 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
|
||||
datePublished,
|
||||
type,
|
||||
files.get(0).toFile(),
|
||||
dependencies.stream().map(Dependency::getProjectId).filter(Objects::nonNull).collect(Collectors.toList()),
|
||||
dependencies.stream().map(dependency -> dependency.getVersionId() == null ? null : dependency.getProjectId()).collect(Collectors.toList()),
|
||||
gameVersions,
|
||||
loaders.stream().flatMap(loader -> {
|
||||
if ("fabric".equalsIgnoreCase(loader)) return Stream.of(ModLoaderType.FABRIC);
|
||||
@ -653,6 +656,9 @@ public final class ModrinthRemoteModRepository implements RemoteModRepository {
|
||||
.collect(Collectors.toSet());
|
||||
List<RemoteMod> mods = new ArrayList<>();
|
||||
for (String dependencyId : dependencies) {
|
||||
if (dependencyId == null) {
|
||||
mods.add(RemoteMod.getEmptyRemoteMod());
|
||||
}
|
||||
if (StringUtils.isNotBlank(dependencyId)) {
|
||||
mods.add(modRepository.getModById(dependencyId));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user