fix: only consider enabled mod loaders

This commit is contained in:
Sefa Eyeoglu 2022-05-19 08:09:18 +02:00
parent b2878dca1d
commit 77caaca50d
No known key found for this signature in database
GPG Key ID: C10411294912A422

View File

@ -36,6 +36,13 @@
#include "ComponentUpdateTask.h" #include "ComponentUpdateTask.h"
#include "Application.h" #include "Application.h"
#include "modplatform/ModAPI.h"
static const QMap<QString, ModAPI::ModLoaderType> modloaderMapping{
{"net.minecraftforge", ModAPI::Forge},
{"net.fabricmc.fabric-loader", ModAPI::Fabric},
{"org.quiltmc.quilt-loader", ModAPI::Quilt}
};
PackProfile::PackProfile(MinecraftInstance * instance) PackProfile::PackProfile(MinecraftInstance * instance)
: QAbstractListModel() : QAbstractListModel()
@ -973,17 +980,15 @@ void PackProfile::disableInteraction(bool disable)
ModAPI::ModLoaderType PackProfile::getModLoader() ModAPI::ModLoaderType PackProfile::getModLoader()
{ {
if (!getComponentVersion("net.minecraftforge").isEmpty()) QMapIterator<QString, ModAPI::ModLoaderType> i(modloaderMapping);
while (i.hasNext())
{ {
return ModAPI::Forge; i.next();
Component* c = getComponent(i.key());
if (c != nullptr && c->isEnabled()) {
return i.value();
} }
else if (!getComponentVersion("net.fabricmc.fabric-loader").isEmpty())
{
return ModAPI::Fabric;
}
else if (!getComponentVersion("org.quiltmc.quilt-loader").isEmpty())
{
return ModAPI::Quilt;
} }
return ModAPI::Unspecified; return ModAPI::Unspecified;
} }