NOISSUE Support Fabric modpacks on ATLauncher

Annoyingly the metadata structure is loader dependent :(
This commit is contained in:
Jamie Mansfield 2021-04-14 18:20:50 +01:00
parent 73788f5d2f
commit 438ddfb88d
No known key found for this signature in database
GPG Key ID: 36F61598F39F67B0

View File

@ -84,12 +84,18 @@ static void loadVersionLoader(ATLauncher::VersionLoader & p, QJsonObject & obj)
p.choose = Json::ensureBoolean(obj, QString("choose"), false); p.choose = Json::ensureBoolean(obj, QString("choose"), false);
auto metadata = Json::requireObject(obj, "metadata"); auto metadata = Json::requireObject(obj, "metadata");
if (metadata.contains("version")) {
p.version = Json::requireString(metadata, "version");
}
p.latest = Json::ensureBoolean(metadata, QString("latest"), false); p.latest = Json::ensureBoolean(metadata, QString("latest"), false);
p.recommended = Json::ensureBoolean(metadata, QString("recommended"), false); p.recommended = Json::ensureBoolean(metadata, QString("recommended"), false);
// Minecraft Forge
if (p.type == "forge") {
p.version = Json::ensureString(metadata, "version", "");
}
// Fabric Loader
if (p.type == "fabric") {
p.version = Json::ensureString(metadata, "loader", "");
}
} }
static void loadVersionLibrary(ATLauncher::VersionLibrary & p, QJsonObject & obj) { static void loadVersionLibrary(ATLauncher::VersionLibrary & p, QJsonObject & obj) {