diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-04-13 09:28:25 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-04-13 09:28:25 +0200 |
commit | be53eb66f8a63730f4def5640db6205678b4e9d8 (patch) | |
tree | bd5bdef96985312b6687b40f8835336bb3f56bb3 /api/logic/minecraft/MinecraftProfile.cpp | |
parent | db7357d008ae1f4ac0599b7e410ab666dbea5805 (diff) | |
download | MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar.gz MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar.lz MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar.xz MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.zip |
NOISSUE implement mainJar support in OneSix format
This allows customizing the main jar like any other library.
Diffstat (limited to 'api/logic/minecraft/MinecraftProfile.cpp')
-rw-r--r-- | api/logic/minecraft/MinecraftProfile.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/api/logic/minecraft/MinecraftProfile.cpp b/api/logic/minecraft/MinecraftProfile.cpp index c04669c1..efe4651b 100644 --- a/api/logic/minecraft/MinecraftProfile.cpp +++ b/api/logic/minecraft/MinecraftProfile.cpp @@ -517,6 +517,19 @@ void MinecraftProfile::applyLibrary(LibraryPtr library) } } +const LibraryPtr MinecraftProfile::getMainJar() const +{ + return m_mainJar; +} + +void MinecraftProfile::applyMainJar(LibraryPtr jar) +{ + if(jar) + { + m_mainJar = jar; + } +} + void MinecraftProfile::applyProblemSeverity(ProblemSeverity severity) { if (m_problemSeverity < severity) @@ -595,7 +608,7 @@ const QList<LibraryPtr> & MinecraftProfile::getNativeLibraries() const return m_nativeLibraries; } -void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath) const +void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath, const QString& tempPath) const { QStringList native32, native64; jars.clear(); @@ -604,6 +617,20 @@ void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& { lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath); } + // NOTE: order is important here, add main jar last to the lists + if(m_mainJar) + { + // FIXME: HACK!! jar modding is weird and unsystematic! + if(m_jarMods.size()) + { + QDir tempDir(tempPath); + jars.append(tempDir.absoluteFilePath("minecraft.jar")); + } + else + { + m_mainJar->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath); + } + } for (auto lib : getNativeLibraries()) { lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath); @@ -618,22 +645,6 @@ void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& } } - -QString MinecraftProfile::getMainJarUrl() const -{ - auto iter = mojangDownloads.find("client"); - if(iter != mojangDownloads.end()) - { - // current - return iter.value()->url; - } - else - { - // legacy fallback - return URLConstants::getLegacyJarUrl(getMinecraftVersion()); - } -} - void MinecraftProfile::installJarMods(QStringList selectedFiles) { m_strategy->installJarMods(selectedFiles); |