From 02c1df2c3c260fe625b9c3314e9eed2885a97456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 13 Mar 2016 00:23:45 +0100 Subject: NOISSUE continue version file format refactors --- logic/minecraft/forge/ForgeInstaller.cpp | 38 ++++++++------------------------ 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'logic/minecraft/forge') diff --git a/logic/minecraft/forge/ForgeInstaller.cpp b/logic/minecraft/forge/ForgeInstaller.cpp index bc0a967e..a72160a2 100644 --- a/logic/minecraft/forge/ForgeInstaller.cpp +++ b/logic/minecraft/forge/ForgeInstaller.cpp @@ -119,7 +119,7 @@ void ForgeInstaller::prepare(const QString &filename, const QString &universalUr file.close(); m_forge_json = newVersion; - m_forge_json->id = installObj.value("minecraft").toString(); + //m_forge_json->id = installObj.value("minecraft").toString(); } bool ForgeInstaller::add(OneSixInstance *to) @@ -134,15 +134,14 @@ bool ForgeInstaller::add(OneSixInstance *to) if (!m_forge_json) return false; - int sliding_insert_window = 0; { - QJsonArray librariesPlus; + QJsonArray libraries; // A blacklist QSet blacklist{"authlib", "realms"}; // QList xzlist{"org.scala-lang", "com.typesafe"}; // for each library in the version we are adding (except for the blacklisted) - for (auto lib : m_forge_json->libraries) + for (auto lib : m_forge_json->getLibraries()) { QString libName = lib->artifactId(); QString rawName = lib->rawName(); @@ -194,41 +193,27 @@ bool ForgeInstaller::add(OneSixInstance *to) QJsonObject libObj = OneSixVersionFormat::libraryToJson(lib.get()); - bool found = false; bool equals = false; // find an entry that matches this one - for (auto tolib : to->getMinecraftProfile()->vanillaLibraries) + for (auto tolib : to->getMinecraftProfile()->getVanillaLibraries()) { if (tolib->artifactId() != libName) continue; - found = true; if (OneSixVersionFormat::libraryToJson(tolib.get()) == libObj) { equals = true; } - // replace lib - libObj.insert("insert", QString("replace")); break; } if (equals) { continue; } - if (!found) - { - // add lib - libObj.insert("insert", QString("prepend")); - if (lib->artifactId() == "minecraftforge" || lib->artifactId() == "forge") - { - libObj.insert("MMC-depend", QString("hard")); - } - sliding_insert_window++; - } - librariesPlus.prepend(libObj); + libraries.append(libObj); } - obj.insert("+libraries", librariesPlus); - obj.insert("mainClass", m_forge_json->mainClass); - QString args = m_forge_json->minecraftArguments; + obj.insert("libraries", libraries); + obj.insert("mainClass", m_forge_json->getMainClass()); + QString args = m_forge_json->getMinecraftArguments(); QStringList tweakers; { QRegularExpression expression("--tweakClass ([a-zA-Z0-9\\.]*)"); @@ -240,7 +225,7 @@ bool ForgeInstaller::add(OneSixInstance *to) match = expression.match(args); } } - if (!args.isEmpty() && args != to->getMinecraftProfile()->vanillaMinecraftArguments) + if (!args.isEmpty() && args != to->getMinecraftProfile()->getVanillaMinecraftArguments()) { obj.insert("minecraftArguments", args); } @@ -248,11 +233,6 @@ bool ForgeInstaller::add(OneSixInstance *to) { obj.insert("+tweakers", QJsonArray::fromStringList(tweakers)); } - if (!m_forge_json->processArguments.isEmpty() && - m_forge_json->processArguments != to->getMinecraftProfile()->vanillaProcessArguments) - { - obj.insert("processArguments", m_forge_json->processArguments); - } } obj.insert("name", QString("Forge")); -- cgit v1.2.3