Added error message when exporting snapshots with curseforge

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-06-25 12:24:59 +03:00
parent 932531c8ba
commit fd5b155ee7
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 19 additions and 8 deletions

View File

@ -409,16 +409,20 @@ QByteArray FlamePackExportTask::generateIndex()
// convert all available components to mrpack dependencies
if (minecraft != nullptr)
version["version"] = minecraft->m_version;
QJsonObject loader;
QString id;
if (quilt != nullptr)
loader["id"] = "quilt-" + quilt->getVersion();
id = "quilt-" + quilt->getVersion();
else if (fabric != nullptr)
loader["id"] = "fabric-" + fabric->getVersion();
id = "fabric-" + fabric->getVersion();
else if (forge != nullptr)
loader["id"] = "forge-" + forge->getVersion();
loader["primary"] = true;
version["modLoaders"] = QJsonArray({ loader });
id = "forge-" + forge->getVersion();
version["modLoaders"] = QJsonArray();
if (!id.isEmpty()) {
QJsonObject loader;
loader["id"] = id;
loader["primary"] = true;
version["modLoaders"] = QJsonArray({ loader });
}
obj["minecraft"] = version;
}

View File

@ -1422,9 +1422,16 @@ void MainWindow::on_actionExportInstanceFlamePack_triggered()
if (m_selectedInstance) {
auto instance = dynamic_cast<MinecraftInstance*>(m_selectedInstance.get());
if (instance) {
QString errorMsg;
if (instance->getPackProfile()->getComponent("org.quiltmc.quilt-loader")) {
errorMsg = tr("Quilt is currently not supported by CurseForge modpacks.");
} else if (auto cmp = instance->getPackProfile()->getComponent("net.minecraft");
cmp && cmp->getVersionFile() && cmp->getVersionFile()->type == "snapshot") {
errorMsg = tr("Snapshots are currently not supported by CurseForge modpacks.");
}
if (!errorMsg.isEmpty()) {
QMessageBox msgBox;
msgBox.setText(tr("Quilt is currently not supported by CurseForge modpacks."));
msgBox.setText(errorMsg);
msgBox.exec();
return;
}