aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-02-27 15:05:38 -0300
committerflow <thiagodonato300@gmail.com>2022-02-27 16:07:45 -0300
commit075d900d45f25475c7fe600d6237f17d5c257d30 (patch)
tree3b038eff96d1c939c5323544992eb1b6a5bc7661 /launcher/modplatform/flame
parent84e9ce71b06f7f123eb0a600ccd9fa0700bae647 (diff)
downloadPrismLauncher-075d900d45f25475c7fe600d6237f17d5c257d30.tar.gz
PrismLauncher-075d900d45f25475c7fe600d6237f17d5c257d30.tar.bz2
PrismLauncher-075d900d45f25475c7fe600d6237f17d5c257d30.zip
fix: Always tell Flame API which modloader we are using
Fixes #206 partially. Although we don't list mods that have no compatibility with the mod loader we are using, mods that have support for both loaders still show up, and the versions for both the loaders are still shown. Also simplifies a little the logic in FlameModIndex::loadIndexedPackVersions
Diffstat (limited to 'launcher/modplatform/flame')
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index a8b2495a..082ffa57 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -50,42 +50,44 @@ void FlameMod::loadIndexedPackVersions(FlameMod::IndexedPack & pack, QJsonArray
for(auto versionIter: arr) {
auto obj = versionIter.toObject();
- FlameMod::IndexedVersion file;
- file.addonId = pack.addonId;
- file.fileId = Json::requireInteger(obj, "id");
- file.date = Json::requireString(obj, "fileDate");
+
auto versionArray = Json::requireArray(obj, "gameVersion");
- if (versionArray.empty()) {
+ if (versionArray.isEmpty()) {
continue;
}
+
+ FlameMod::IndexedVersion file;
for(auto mcVer : versionArray){
file.mcVersion.append(mcVer.toString());
}
+ file.addonId = pack.addonId;
+ file.fileId = Json::requireInteger(obj, "id");
+ file.date = Json::requireString(obj, "fileDate");
file.version = Json::requireString(obj, "displayName");
file.downloadUrl = Json::requireString(obj, "downloadUrl");
file.fileName = Json::requireString(obj, "fileName");
auto modules = Json::requireArray(obj, "modules");
- bool valid = false;
+ bool is_valid_fabric_version = false;
for(auto m : modules){
auto fname = Json::requireString(m.toObject(),"foldername");
+ // FIXME: This does not work properly when a mod supports more than one mod loader, since
+ // they bundle the meta files for all of them in the same arquive, even when that version
+ // doesn't support the given mod loader.
if(hasFabric){
if(fname == "fabric.mod.json"){
- valid = true;
- break;
- }
- }else{
- //this cannot check for the recent mcmod.toml formats
- if(fname == "mcmod.info"){
- valid = true;
+ is_valid_fabric_version = true;
break;
}
}
+ else if(fname == "mcmod.info"){ //this cannot check for the recent mcmod.toml formats
+ break;
+ }
}
- if(!valid && hasFabric){
+
+ if(hasFabric && !is_valid_fabric_version)
continue;
- }
unsortedVersions.append(file);
}