Merge pull request #890 from Scrumplex/fix-technic-forge

Fix Technic instances using Forge
This commit is contained in:
flow 2022-07-08 16:18:59 -03:00 committed by GitHub
commit 998271414e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,17 +187,17 @@ void Technic::TechnicPackProcessor::run(SettingsObjectPtr globalSettings, const
}
else
{
static QStringList possibleLoaders{
"net.minecraftforge:minecraftforge:",
"net.fabricmc:fabric-loader:",
"org.quiltmc:quilt-loader:"
// <Technic library name prefix> -> <our component name>
static QMap<QString, QString> loaderMap {
{"net.minecraftforge:minecraftforge:", "net.minecraftforge"},
{"net.fabricmc:fabric-loader:", "net.fabricmc.fabric-loader"},
{"org.quiltmc:quilt-loader:", "org.quiltmc.quilt-loader"}
};
for (const auto& loader : possibleLoaders)
for (const auto& loader : loaderMap.keys())
{
if (libraryName.startsWith(loader))
{
auto loaderComponent = loader.chopped(1).replace(":", ".");
components->setComponentVersion(loaderComponent, libraryName.section(':', 2));
components->setComponentVersion(loaderMap.value(loader), libraryName.section(':', 2));
break;
}
}