fix: check for Quilt as Fabric-compatible loader
This commit is contained in:
@ -56,6 +56,8 @@
|
||||
#include "minecraft/VersionFilterData.h"
|
||||
#include "minecraft/PackProfile.h"
|
||||
|
||||
#include "modplatform/ModAPI.h"
|
||||
|
||||
#include "Version.h"
|
||||
#include "ui/dialogs/ProgressDialog.h"
|
||||
#include "tasks/SequentialTask.h"
|
||||
@ -388,9 +390,9 @@ void ModFolderPage::on_actionInstall_mods_triggered()
|
||||
if(m_inst->typeName() != "Minecraft"){
|
||||
return; //this is a null instance or a legacy instance
|
||||
}
|
||||
bool hasFabric = !((MinecraftInstance *)m_inst)->getPackProfile()->getComponentVersion("net.fabricmc.fabric-loader").isEmpty();
|
||||
bool hasForge = !((MinecraftInstance *)m_inst)->getPackProfile()->getComponentVersion("net.minecraftforge").isEmpty();
|
||||
if (!hasFabric && !hasForge) {
|
||||
QStringList modLoaders = {"net.minecraftforge", "net.fabricmc.fabric-loader", "org.quiltmc.quilt-loader"};
|
||||
auto profile = ((MinecraftInstance *)m_inst)->getPackProfile();
|
||||
if (profile->getModLoader() == ModAPI::Any) {
|
||||
QMessageBox::critical(this,tr("Error"),tr("Please install a mod loader first!"));
|
||||
return;
|
||||
}
|
||||
|
@ -61,14 +61,18 @@ auto ListModel::data(const QModelIndex& index, int role) const -> QVariant
|
||||
|
||||
void ListModel::requestModVersions(ModPlatform::IndexedPack const& current)
|
||||
{
|
||||
auto profile = (dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))->getPackProfile();
|
||||
|
||||
m_parent->apiProvider()->getVersions(this,
|
||||
{ current.addonId.toString(), getMineVersions(), hasFabric() ? ModAPI::ModLoaderType::Fabric : ModAPI::ModLoaderType::Forge });
|
||||
{ current.addonId.toString(), getMineVersions(), profile->getModLoader() });
|
||||
}
|
||||
|
||||
void ListModel::performPaginatedSearch()
|
||||
{
|
||||
auto profile = (dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))->getPackProfile();
|
||||
|
||||
m_parent->apiProvider()->searchMods(this,
|
||||
{ nextSearchOffset, currentSearchTerm, getSorts()[currentSort], hasFabric() ? ModAPI::Fabric : ModAPI::Forge, getMineVersions().at(0) });
|
||||
{ nextSearchOffset, currentSearchTerm, getSorts()[currentSort], profile->getModLoader(), getMineVersions().at(0) });
|
||||
}
|
||||
|
||||
void ListModel::searchWithTerm(const QString& term, const int sort)
|
||||
@ -218,13 +222,6 @@ void ListModel::versionRequestSucceeded(QJsonDocument doc, QString addonId)
|
||||
} // namespace ModPlatform
|
||||
|
||||
/******** Helpers ********/
|
||||
auto ModPlatform::ListModel::hasFabric() const -> bool
|
||||
{
|
||||
return !(dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))
|
||||
->getPackProfile()
|
||||
->getComponentVersion("net.fabricmc.fabric-loader")
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
auto ModPlatform::ListModel::getMineVersions() const -> QList<QString>
|
||||
{
|
||||
|
@ -62,7 +62,6 @@ class ListModel : public QAbstractListModel {
|
||||
|
||||
void requestLogo(QString file, QString url);
|
||||
|
||||
inline auto hasFabric() const -> bool;
|
||||
inline auto getMineVersions() const -> QList<QString>;
|
||||
|
||||
protected:
|
||||
|
@ -136,7 +136,21 @@ void ModPage::updateModVersions()
|
||||
auto packProfile = (dynamic_cast<MinecraftInstance*>(m_instance))->getPackProfile();
|
||||
|
||||
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
|
||||
QString loaderString = (packProfile->getComponentVersion("net.minecraftforge").isEmpty()) ? "fabric" : "forge";
|
||||
|
||||
QString loaderString;
|
||||
switch (packProfile->getModLoader()) {
|
||||
case ModAPI::Forge:
|
||||
loaderString = "forge";
|
||||
break;
|
||||
case ModAPI::Fabric:
|
||||
loaderString = "fabric";
|
||||
break;
|
||||
case ModAPI::Quilt:
|
||||
loaderString = "quilt";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < current.versions.size(); i++) {
|
||||
auto version = current.versions[i];
|
||||
|
Reference in New Issue
Block a user