修复cf源无法获取前置模组 (#1520)
* 修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能 * Revert "修复Modrinth源加载列表失败,增加Modrinth源获取前置模组功能" This reverts commit 1d29c69d92db8714599ed8f8b524e143e278b80a. * 修复CF源获取模组版本列表不全 * Modrinth源获取类别列表,搜索时增加类别选项 * Update ModrinthRemoteModRepository.java * Update ModrinthRemoteModRepository.java * 修复cf源获取前置模组失败 * Revert "Update ModrinthRemoteModRepository.java" This reverts commit 40b7c1d59d4b8918e633d6db1ed73df5bcbbc9ae. * Revert "Revert "Update ModrinthRemoteModRepository.java"" This reverts commit 2027c9ef4c9d7fc668229c9484f63bfb9d4dbb07. * Revert "修复cf源获取前置模组失败" This reverts commit 4404daf0eaecf194fa264208a3d7edeccad15c1e. * fix conflict * 修复cf源无法获取前置模组 * fix check style
This commit is contained in:
@@ -182,8 +182,8 @@ public class CurseAddon implements RemoteMod.IMod {
|
|||||||
public List<RemoteMod> loadDependencies(RemoteModRepository modRepository) throws IOException {
|
public List<RemoteMod> loadDependencies(RemoteModRepository modRepository) throws IOException {
|
||||||
Set<Integer> dependencies = latestFiles.stream()
|
Set<Integer> dependencies = latestFiles.stream()
|
||||||
.flatMap(latestFile -> latestFile.getDependencies().stream())
|
.flatMap(latestFile -> latestFile.getDependencies().stream())
|
||||||
.filter(dep -> dep.getType() == 3)
|
.filter(dep -> dep.getRelationType() == 3)
|
||||||
.map(Dependency::getAddonId)
|
.map(Dependency::getModId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
List<RemoteMod> mods = new ArrayList<>();
|
List<RemoteMod> mods = new ArrayList<>();
|
||||||
for (int dependencyId : dependencies) {
|
for (int dependencyId : dependencies) {
|
||||||
@@ -370,36 +370,24 @@ public class CurseAddon implements RemoteMod.IMod {
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
public static class Dependency {
|
public static class Dependency {
|
||||||
private final int id;
|
private final int modId;
|
||||||
private final int addonId;
|
private final int relationType;
|
||||||
private final int type;
|
|
||||||
private final int fileId;
|
|
||||||
|
|
||||||
public Dependency() {
|
public Dependency() {
|
||||||
this(0, 0, 0, 0);
|
this(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dependency(int id, int addonId, int type, int fileId) {
|
public Dependency(int modId, int relationType) {
|
||||||
this.id = id;
|
this.modId = modId;
|
||||||
this.addonId = addonId;
|
this.relationType = relationType;
|
||||||
this.type = type;
|
|
||||||
this.fileId = fileId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getModId() {
|
||||||
return id;
|
return modId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAddonId() {
|
public int getRelationType() {
|
||||||
return addonId;
|
return relationType;
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFileId() {
|
|
||||||
return fileId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,9 +145,11 @@ public final class CurseForgeRemoteModRepository implements RemoteModRepository
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoteMod getModById(String id) throws IOException {
|
public RemoteMod getModById(String id) throws IOException {
|
||||||
return HttpRequest.GET(PREFIX + "/v1/mods/" + id)
|
Response<CurseAddon> response = HttpRequest.GET(PREFIX + "/v1/mods/" + id)
|
||||||
.header("X-API-KEY", apiKey)
|
.header("X-API-KEY", apiKey)
|
||||||
.getJson(CurseAddon.class).toMod();
|
.getJson(new TypeToken<Response<CurseAddon>>() {
|
||||||
|
}.getType());
|
||||||
|
return response.data.toMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user