diff options
author | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-23 12:52:51 +0300 |
---|---|---|
committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-23 12:52:51 +0300 |
commit | e6ba2f4970abe69f2203bb5b85503e4cf3177016 (patch) | |
tree | 6d41ead389c2249e8bc79766666f6fb952ada835 /launcher/minecraft | |
parent | f8f9ffa1182c76cd22c2c181820bdd9516d7958f (diff) | |
download | PrismLauncher-e6ba2f4970abe69f2203bb5b85503e4cf3177016.tar.gz PrismLauncher-e6ba2f4970abe69f2203bb5b85503e4cf3177016.tar.bz2 PrismLauncher-e6ba2f4970abe69f2203bb5b85503e4cf3177016.zip |
Added loaders check on versions load
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/minecraft')
-rw-r--r-- | launcher/minecraft/ComponentUpdateTask.cpp | 4 | ||||
-rw-r--r-- | launcher/minecraft/PackProfile.cpp | 20 | ||||
-rw-r--r-- | launcher/minecraft/PackProfile.h | 8 | ||||
-rw-r--r-- | launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp | 3 |
4 files changed, 24 insertions, 11 deletions
diff --git a/launcher/minecraft/ComponentUpdateTask.cpp b/launcher/minecraft/ComponentUpdateTask.cpp index 0b85b81a..bb838043 100644 --- a/launcher/minecraft/ComponentUpdateTask.cpp +++ b/launcher/minecraft/ComponentUpdateTask.cpp @@ -2,14 +2,14 @@ #include "Component.h" #include "ComponentUpdateTask_p.h" -#include "OneSixVersionFormat.h" #include "PackProfile.h" #include "PackProfile_p.h" #include "Version.h" #include "cassert" #include "meta/Index.h" #include "meta/Version.h" -#include "meta/VersionList.h" +#include "minecraft/OneSixVersionFormat.h" +#include "minecraft/ProfileUtils.h" #include "net/Mode.h" #include "Application.h" diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp index dd736485..9e42c5dd 100644 --- a/launcher/minecraft/PackProfile.cpp +++ b/launcher/minecraft/PackProfile.cpp @@ -58,9 +58,8 @@ #include "ComponentUpdateTask.h" #include "PackProfile.h" #include "PackProfile_p.h" - -#include "Application.h" -#include "modplatform/ResourceAPI.h" +#include "minecraft/mod/Mod.h" +#include "modplatform/ModIndex.h" static const QMap<QString, ModPlatform::ModLoaderType> modloaderMapping{ { "net.neoforged", ModPlatform::NeoForge }, { "net.minecraftforge", ModPlatform::Forge }, @@ -1009,3 +1008,18 @@ std::optional<ModPlatform::ModLoaderTypes> PackProfile::getModLoaders() return {}; return result; } + +std::optional<ModPlatform::ModLoaderTypes> PackProfile::getSupportedModLoaders() +{ + auto loadersOpt = getModLoaders(); + if (!loadersOpt.has_value()) + return loadersOpt; + auto loaders = loadersOpt.value(); + // TODO: remove this or add version condition once Quilt drops official Fabric support + if (loaders & ModPlatform::Quilt) + loaders |= ModPlatform::Fabric; + // TODO: remove this or add version condition once NeoForge drops official Forge support + if (loaders & ModPlatform::NeoForge) + loaders |= ModPlatform::Forge; + return loaders; +} diff --git a/launcher/minecraft/PackProfile.h b/launcher/minecraft/PackProfile.h index 4b93d654..c41601fb 100644 --- a/launcher/minecraft/PackProfile.h +++ b/launcher/minecraft/PackProfile.h @@ -45,13 +45,9 @@ #include <QString> #include <memory> -#include "BaseVersion.h" #include "Component.h" #include "LaunchProfile.h" -#include "Library.h" -#include "MojangDownloadInfo.h" -#include "ProfileUtils.h" -#include "modplatform/ResourceAPI.h" +#include "modplatform/ModIndex.h" #include "net/Mode.h" class MinecraftInstance; @@ -147,6 +143,8 @@ class PackProfile : public QAbstractListModel { void appendComponent(ComponentPtr component); std::optional<ModPlatform::ModLoaderTypes> getModLoaders(); + // this returns aditional loaders(Quilt supports fabric and NeoForge supports Forge) + std::optional<ModPlatform::ModLoaderTypes> getSupportedModLoaders(); private: void scheduleSave(); diff --git a/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp b/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp index 46b489ce..93e1b2ed 100644 --- a/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp +++ b/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp @@ -41,7 +41,8 @@ static Version mcVersion(BaseInstance* inst) static ModPlatform::ModLoaderTypes mcLoaders(BaseInstance* inst) { - return static_cast<MinecraftInstance*>(inst)->getPackProfile()->getModLoaders().value(); + return static_cast<MinecraftInstance*>(inst)->getPackProfile()->getSupportedModLoaders().value_or( + ModPlatform::ModLoaderTypes::fromInt(0)); } GetModDependenciesTask::GetModDependenciesTask(QObject* parent, |