diff options
author | Ezekiel Smith <ezekielsmith@protonmail.com> | 2022-04-17 13:46:22 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-17 13:46:22 +1000 |
commit | 703bf9bb7a52aeb20aeba1ad3c07c5709f22d0bb (patch) | |
tree | d39c712ec74421a767e74d4db2185c199604f014 | |
parent | a40dee2230ee18d537a2472bf0e0164a0cf8a390 (diff) | |
parent | cab9afa45f7a7dfcb87080804f3a6ef90f953819 (diff) | |
download | PrismLauncher-703bf9bb7a52aeb20aeba1ad3c07c5709f22d0bb.tar.gz PrismLauncher-703bf9bb7a52aeb20aeba1ad3c07c5709f22d0bb.tar.bz2 PrismLauncher-703bf9bb7a52aeb20aeba1ad3c07c5709f22d0bb.zip |
Merge pull request #431 from Scrumplex/feat-quilt-modrinth
Query for Fabric mods if Quilt is in use
-rw-r--r-- | launcher/modplatform/flame/FlameAPI.h | 11 | ||||
-rw-r--r-- | launcher/modplatform/flame/FlameModIndex.cpp | 6 | ||||
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthAPI.h | 3 |
3 files changed, 17 insertions, 3 deletions
diff --git a/launcher/modplatform/flame/FlameAPI.h b/launcher/modplatform/flame/FlameAPI.h index 9bcc357e..ce02df65 100644 --- a/launcher/modplatform/flame/FlameAPI.h +++ b/launcher/modplatform/flame/FlameAPI.h @@ -23,7 +23,7 @@ class FlameAPI : public NetworkModAPI { .arg(args.offset) .arg(args.search) .arg(args.sorting) - .arg(args.mod_loader) + .arg(getMappedModLoader(args.mod_loader)) .arg(gameVersionStr); }; @@ -31,4 +31,13 @@ class FlameAPI : public NetworkModAPI { { return QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(args.addonId); }; + + public: + static auto getMappedModLoader(const ModLoaderType type) -> const ModLoaderType + { + // TODO: remove this once Quilt drops official Fabric support + if (type == Quilt) // NOTE: Most if not all Fabric mods should work *currently* + return Fabric; + return type; + } }; diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp index e86b64dd..c7b86b5c 100644 --- a/launcher/modplatform/flame/FlameModIndex.cpp +++ b/launcher/modplatform/flame/FlameModIndex.cpp @@ -3,6 +3,7 @@ #include "Json.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" +#include "modplatform/flame/FlameAPI.h" #include "net/NetJob.h" void FlameMod::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj) @@ -43,8 +44,9 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, BaseInstance* inst) { QVector<ModPlatform::IndexedVersion> unsortedVersions; - bool hasFabric = !(dynamic_cast<MinecraftInstance*>(inst))->getPackProfile()->getComponentVersion("net.fabricmc.fabric-loader").isEmpty(); - QString mcVersion = (dynamic_cast<MinecraftInstance*>(inst))->getPackProfile()->getComponentVersion("net.minecraft"); + auto profile = (dynamic_cast<MinecraftInstance*>(inst))->getPackProfile(); + bool hasFabric = FlameAPI::getMappedModLoader(profile->getModLoader()) == ModAPI::Fabric; + QString mcVersion = profile->getComponentVersion("net.minecraft"); for (auto versionIter : arr) { auto obj = versionIter.toObject(); diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 6604d772..84dd7d03 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -54,6 +54,9 @@ class ModrinthAPI : public NetworkModAPI { { if (type == Unspecified) return "fabric, forge, quilt"; + // TODO: remove this once Quilt drops official Fabric support + if (type == Quilt) // NOTE: Most if not all Fabric mods should work *currently* + return "fabric, quilt"; return ModAPI::getModLoaderString(type); } |