summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/forge/ForgeInstaller.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-03-13 00:23:45 +0100
committerPetr Mrázek <peterix@gmail.com>2016-03-26 17:05:27 +0100
commit02c1df2c3c260fe625b9c3314e9eed2885a97456 (patch)
tree1ca64f44fc609ba47a6a1fde4b9e93fe15b1e618 /logic/minecraft/forge/ForgeInstaller.cpp
parent1854e05e1bb14d8f2bbc4676f44024a83e972f6f (diff)
downloadMultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar.gz
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar.lz
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar.xz
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.zip
NOISSUE continue version file format refactors
Diffstat (limited to 'logic/minecraft/forge/ForgeInstaller.cpp')
-rw-r--r--logic/minecraft/forge/ForgeInstaller.cpp38
1 files changed, 9 insertions, 29 deletions
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<QString> blacklist{"authlib", "realms"};
//
QList<QString> 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"));