aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft')
-rw-r--r--launcher/minecraft/PackProfile.cpp31
-rw-r--r--launcher/minecraft/PackProfile.h2
2 files changed, 20 insertions, 13 deletions
diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp
index d53f41e1..125048f0 100644
--- a/launcher/minecraft/PackProfile.cpp
+++ b/launcher/minecraft/PackProfile.cpp
@@ -36,6 +36,13 @@
#include "ComponentUpdateTask.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)
: QAbstractListModel()
@@ -971,19 +978,19 @@ void PackProfile::disableInteraction(bool disable)
}
}
-ModAPI::ModLoaderType PackProfile::getModLoader()
+ModAPI::ModLoaderTypes PackProfile::getModLoaders()
{
- if (!getComponentVersion("net.minecraftforge").isEmpty())
- {
- return ModAPI::Forge;
- }
- else if (!getComponentVersion("net.fabricmc.fabric-loader").isEmpty())
- {
- return ModAPI::Fabric;
- }
- else if (!getComponentVersion("org.quiltmc.quilt-loader").isEmpty())
+ ModAPI::ModLoaderTypes result = ModAPI::Unspecified;
+
+ QMapIterator<QString, ModAPI::ModLoaderType> i(modloaderMapping);
+
+ while (i.hasNext())
{
- return ModAPI::Quilt;
+ i.next();
+ Component* c = getComponent(i.key());
+ if (c != nullptr && c->isEnabled()) {
+ result |= i.value();
+ }
}
- return ModAPI::Unspecified;
+ return result;
}
diff --git a/launcher/minecraft/PackProfile.h b/launcher/minecraft/PackProfile.h
index ab4cd5c8..918e7f7a 100644
--- a/launcher/minecraft/PackProfile.h
+++ b/launcher/minecraft/PackProfile.h
@@ -118,7 +118,7 @@ public:
// todo(merged): is this the best approach
void appendComponent(ComponentPtr component);
- ModAPI::ModLoaderType getModLoader();
+ ModAPI::ModLoaderTypes getModLoaders();
private:
void scheduleSave();