diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseAddon.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseAddon.java index 82a2485e5..00cf85b95 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseAddon.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseAddon.java @@ -182,8 +182,8 @@ public class CurseAddon implements RemoteMod.IMod { public List loadDependencies(RemoteModRepository modRepository) throws IOException { Set dependencies = latestFiles.stream() .flatMap(latestFile -> latestFile.getDependencies().stream()) - .filter(dep -> dep.getType() == 3) - .map(Dependency::getAddonId) + .filter(dep -> dep.getRelationType() == 3) + .map(Dependency::getModId) .collect(Collectors.toSet()); List mods = new ArrayList<>(); for (int dependencyId : dependencies) { @@ -370,36 +370,24 @@ public class CurseAddon implements RemoteMod.IMod { @Immutable public static class Dependency { - private final int id; - private final int addonId; - private final int type; - private final int fileId; + private final int modId; + private final int relationType; public Dependency() { - this(0, 0, 0, 0); + this(0, 1); } - public Dependency(int id, int addonId, int type, int fileId) { - this.id = id; - this.addonId = addonId; - this.type = type; - this.fileId = fileId; + public Dependency(int modId, int relationType) { + this.modId = modId; + this.relationType = relationType; } - public int getId() { - return id; + public int getModId() { + return modId; } - public int getAddonId() { - return addonId; - } - - public int getType() { - return type; - } - - public int getFileId() { - return fileId; + public int getRelationType() { + return relationType; } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseForgeRemoteModRepository.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseForgeRemoteModRepository.java index f981ae736..0999806d3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseForgeRemoteModRepository.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/curse/CurseForgeRemoteModRepository.java @@ -145,9 +145,11 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository @Override public RemoteMod getModById(String id) throws IOException { - return HttpRequest.GET(PREFIX + "/v1/mods/" + id) + Response response = HttpRequest.GET(PREFIX + "/v1/mods/" + id) .header("X-API-KEY", apiKey) - .getJson(CurseAddon.class).toMod(); + .getJson(new TypeToken>() { + }.getType()); + return response.data.toMod(); } @Override