diff --git a/CMakeLists.txt b/CMakeLists.txt index 4459b92eb..84eb76651 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -467,19 +467,27 @@ SET(MULTIMC_SOURCES logic/OneSixInstance_p.h # OneSix version json infrastructure + logic/minecraft/JarMod.cpp + logic/minecraft/JarMod.h + logic/minecraft/MinecraftVersion.cpp logic/minecraft/MinecraftVersion.h - logic/minecraft/OneSixVersionBuilder.h - logic/minecraft/OneSixVersionBuilder.cpp - logic/minecraft/VersionFile.h - logic/minecraft/VersionFile.cpp - logic/minecraft/VersionFinal.h - logic/minecraft/VersionFinal.cpp - logic/minecraft/OneSixLibrary.h - logic/minecraft/OneSixLibrary.cpp - logic/minecraft/OneSixRule.h - logic/minecraft/OneSixRule.cpp - logic/minecraft/MinecraftVersionList.h logic/minecraft/MinecraftVersionList.cpp + logic/minecraft/MinecraftVersionList.h + logic/minecraft/OneSixLibrary.cpp + logic/minecraft/OneSixLibrary.h + logic/minecraft/OneSixRule.cpp + logic/minecraft/OneSixRule.h + logic/minecraft/OpSys.cpp + logic/minecraft/OpSys.h + logic/minecraft/RawLibrary.cpp + logic/minecraft/RawLibrary.h + logic/minecraft/VersionBuilder.cpp + logic/minecraft/VersionBuilder.h + logic/minecraft/VersionFile.cpp + logic/minecraft/VersionFile.h + logic/minecraft/VersionFinal.cpp + logic/minecraft/VersionFinal.h + logic/minecraft/VersionPatch.h # Trivial operating system utilities logic/minecraft/OpSys.h diff --git a/gui/dialogs/InstanceEditDialog.cpp b/gui/dialogs/InstanceEditDialog.cpp index fc2d6a75b..1fca3b7c9 100644 --- a/gui/dialogs/InstanceEditDialog.cpp +++ b/gui/dialogs/InstanceEditDialog.cpp @@ -40,7 +40,7 @@ #include "logic/forge/ForgeInstaller.h" #include "logic/liteloader/LiteLoaderVersionList.h" #include "logic/liteloader/LiteLoaderInstaller.h" -#include "logic/minecraft/OneSixVersionBuilder.h" +#include "logic/minecraft/VersionBuilder.h" #include "logic/auth/MojangAccountList.h" #include diff --git a/logic/OneSixFTBInstance.cpp b/logic/OneSixFTBInstance.cpp index 491b15bac..eb0e4ba4b 100644 --- a/logic/OneSixFTBInstance.cpp +++ b/logic/OneSixFTBInstance.cpp @@ -2,7 +2,7 @@ #include "logic/minecraft/VersionFinal.h" #include "logic/minecraft/OneSixLibrary.h" -#include "logic/minecraft/OneSixVersionBuilder.h" +#include "logic/minecraft/VersionBuilder.h" #include "tasks/SequentialTask.h" #include "forge/ForgeInstaller.h" #include "forge/ForgeVersionList.h" diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp index 66a699fe6..beb293fff 100644 --- a/logic/OneSixUpdate.cpp +++ b/logic/OneSixUpdate.cpp @@ -480,7 +480,7 @@ void OneSixUpdate::fmllibsStart() // determine if we need some libs for FML or forge setStatus(tr("Checking for FML libraries...")); - forge_present = (fullversion->versionFile("net.minecraftforge") != nullptr); + forge_present = (fullversion->versionPatch("net.minecraftforge") != nullptr); // we don't... if (!forge_present) { diff --git a/logic/minecraft/JarMod.cpp b/logic/minecraft/JarMod.cpp new file mode 100644 index 000000000..99a30aa58 --- /dev/null +++ b/logic/minecraft/JarMod.cpp @@ -0,0 +1,44 @@ +#include "JarMod.h" +#include "logic/MMCJson.h" + +JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename) +{ + JarmodPtr out(new Jarmod()); + if (!libObj.contains("name")) + { + throw JSONValidationError(filename + + "contains a jarmod that doesn't have a 'name' field"); + } + out->name = libObj.value("name").toString(); + + auto readString = [libObj, filename](const QString & key, QString & variable) + { + if (libObj.contains(key)) + { + QJsonValue val = libObj.value(key); + if (!val.isString()) + { + QLOG_WARN() << key << "is not a string in" << filename << "(skipping)"; + } + else + { + variable = val.toString(); + } + } + }; + + readString("url", out->baseurl); + readString("MMC-absoluteUrl", out->absoluteUrl); + if(!out->baseurl.isEmpty() && out->absoluteUrl.isEmpty()) + { + out->absoluteUrl = out->baseurl + out->name; + } + return out; +} + +QString Jarmod::url() +{ + if(!absoluteUrl.isEmpty()) + return absoluteUrl; + else return baseurl + name; +} diff --git a/logic/minecraft/JarMod.h b/logic/minecraft/JarMod.h new file mode 100644 index 000000000..da5d8db01 --- /dev/null +++ b/logic/minecraft/JarMod.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include +#include +class Jarmod; +typedef std::shared_ptr JarmodPtr; +class Jarmod +{ +public: /* methods */ + static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename); + QString url(); +public: /* data */ + QString name; + QString baseurl; + QString hint; + QString absoluteUrl; +}; diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp new file mode 100644 index 000000000..a2e5a50a2 --- /dev/null +++ b/logic/minecraft/MinecraftVersion.cpp @@ -0,0 +1,2 @@ +#include "MinecraftVersion.h" + diff --git a/logic/minecraft/MinecraftVersion.h b/logic/minecraft/MinecraftVersion.h index 3be259122..dab08bb1c 100644 --- a/logic/minecraft/MinecraftVersion.h +++ b/logic/minecraft/MinecraftVersion.h @@ -16,10 +16,11 @@ #pragma once #include "logic/BaseVersion.h" +#include "VersionPatch.h" #include #include -struct MinecraftVersion : public BaseVersion +struct MinecraftVersion : public BaseVersion, public VersionPatch { /// The version's timestamp - this is primarily used for sorting versions in a list. qint64 timestamp; @@ -89,4 +90,19 @@ struct MinecraftVersion : public BaseVersion return QObject::tr("Regular release"); } } + + virtual bool hasJarMods() override + { + return false; + } + + virtual bool isVanilla() override + { + return true; + } + + virtual void applyTo(VersionFinal *version) + { + // umm... what now? + } }; diff --git a/logic/minecraft/OneSixRule.cpp b/logic/minecraft/OneSixRule.cpp index d8d13b50c..93c49e5e2 100644 --- a/logic/minecraft/OneSixRule.cpp +++ b/logic/minecraft/OneSixRule.cpp @@ -18,6 +18,15 @@ #include "OneSixRule.h" +RuleAction RuleAction_fromString(QString name) +{ + if (name == "allow") + return Allow; + if (name == "disallow") + return Disallow; + return Defer; +} + QList> rulesFromJsonV4(const QJsonObject &objectWithRules) { QList> rules; @@ -79,11 +88,3 @@ QJsonObject OsRule::toJson() return ruleObj; } -RuleAction RuleAction_fromString(QString name) -{ - if (name == "allow") - return Allow; - if (name == "disallow") - return Disallow; - return Defer; -} diff --git a/logic/minecraft/OneSixRule.h b/logic/minecraft/OneSixRule.h index 2c569b9f7..23d041512 100644 --- a/logic/minecraft/OneSixRule.h +++ b/logic/minecraft/OneSixRule.h @@ -26,7 +26,6 @@ enum RuleAction Defer }; -RuleAction RuleAction_fromString(QString); QList> rulesFromJsonV4(const QJsonObject &objectWithRules); class Rule diff --git a/logic/minecraft/RawLibrary.cpp b/logic/minecraft/RawLibrary.cpp new file mode 100644 index 000000000..12aac8c84 --- /dev/null +++ b/logic/minecraft/RawLibrary.cpp @@ -0,0 +1,68 @@ +#include "logic/MMCJson.h" +using namespace MMCJson; + +#include "RawLibrary.h" + +RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &filename) +{ + RawLibraryPtr out(new RawLibrary()); + if (!libObj.contains("name")) + { + throw JSONValidationError(filename + + "contains a library that doesn't have a 'name' field"); + } + out->name = libObj.value("name").toString(); + + auto readString = [libObj, filename](const QString & key, QString & variable) + { + if (libObj.contains(key)) + { + QJsonValue val = libObj.value(key); + if (!val.isString()) + { + QLOG_WARN() << key << "is not a string in" << filename << "(skipping)"; + } + else + { + variable = val.toString(); + } + } + }; + + readString("url", out->url); + readString("MMC-hint", out->hint); + readString("MMC-absulute_url", out->absoluteUrl); + readString("MMC-absoluteUrl", out->absoluteUrl); + if (libObj.contains("extract")) + { + out->applyExcludes = true; + auto extractObj = ensureObject(libObj.value("extract")); + for (auto excludeVal : ensureArray(extractObj.value("exclude"))) + { + out->excludes.append(ensureString(excludeVal)); + } + } + if (libObj.contains("natives")) + { + out->applyNatives = true; + QJsonObject nativesObj = ensureObject(libObj.value("natives")); + for (auto it = nativesObj.begin(); it != nativesObj.end(); ++it) + { + if (!it.value().isString()) + { + QLOG_WARN() << filename << "contains an invalid native (skipping)"; + } + OpSys opSys = OpSys_fromString(it.key()); + if (opSys != Os_Other) + { + out->natives.append(qMakePair(opSys, it.value().toString())); + } + } + } + if (libObj.contains("rules")) + { + out->applyRules = true; + out->rules = rulesFromJsonV4(libObj); + } + return out; +} diff --git a/logic/minecraft/RawLibrary.h b/logic/minecraft/RawLibrary.h new file mode 100644 index 000000000..46178d8e0 --- /dev/null +++ b/logic/minecraft/RawLibrary.h @@ -0,0 +1,47 @@ +#pragma once +#include +#include +#include + +#include "OneSixRule.h" + +class RawLibrary; +typedef std::shared_ptr RawLibraryPtr; + +class RawLibrary +{ +public: /* methods */ + static RawLibraryPtr fromJson(const QJsonObject &libObj, const QString &filename); + +public: /* data */ + QString name; + QString url; + QString hint; + QString absoluteUrl; + + bool applyExcludes = false; + QStringList excludes; + + bool applyNatives = false; + QList> natives; + + bool applyRules = false; + QList> rules; + + // user for '+' libraries + enum InsertType + { + Apply, + Append, + Prepend, + Replace + } insertType = Append; + QString insertData; + + // soft or hard dependency? hard means 'needs equal', soft means 'needs equal or newer' + enum DependType + { + Soft, + Hard + } dependType = Soft; +}; diff --git a/logic/minecraft/OneSixVersionBuilder.cpp b/logic/minecraft/VersionBuilder.cpp similarity index 90% rename from logic/minecraft/OneSixVersionBuilder.cpp rename to logic/minecraft/VersionBuilder.cpp index da8f956c5..56eef4245 100644 --- a/logic/minecraft/OneSixVersionBuilder.cpp +++ b/logic/minecraft/VersionBuilder.cpp @@ -25,7 +25,7 @@ #include #include -#include "logic/minecraft/OneSixVersionBuilder.h" +#include "logic/minecraft/VersionBuilder.h" #include "logic/minecraft/VersionFinal.h" #include "logic/minecraft/OneSixRule.h" #include "logic/minecraft/VersionFile.h" @@ -35,28 +35,28 @@ #include "logger/QsLog.h" -OneSixVersionBuilder::OneSixVersionBuilder() +VersionBuilder::VersionBuilder() { } -void OneSixVersionBuilder::build(VersionFinal *version, OneSixInstance *instance, const QStringList &external) +void VersionBuilder::build(VersionFinal *version, OneSixInstance *instance, const QStringList &external) { - OneSixVersionBuilder builder; + VersionBuilder builder; builder.m_version = version; builder.m_instance = instance; builder.buildInternal(external); } -void OneSixVersionBuilder::readJsonAndApplyToVersion(VersionFinal *version, +void VersionBuilder::readJsonAndApplyToVersion(VersionFinal *version, const QJsonObject &obj) { - OneSixVersionBuilder builder; + VersionBuilder builder; builder.m_version = version; builder.m_instance = 0; builder.readJsonAndApply(obj); } -void OneSixVersionBuilder::buildInternal(const QStringList &external) +void VersionBuilder::buildInternal(const QStringList &external) { m_version->versionFiles.clear(); @@ -139,7 +139,7 @@ void OneSixVersionBuilder::buildInternal(const QStringList &external) -void OneSixVersionBuilder::readJsonAndApply(const QJsonObject &obj) +void VersionBuilder::readJsonAndApply(const QJsonObject &obj) { m_version->clear(); @@ -153,7 +153,7 @@ void OneSixVersionBuilder::readJsonAndApply(const QJsonObject &obj) // version of MultiMC")); } -VersionFilePtr OneSixVersionBuilder::parseJsonFile(const QFileInfo &fileInfo, +VersionFilePtr VersionBuilder::parseJsonFile(const QFileInfo &fileInfo, const bool requireOrder, bool isFTB) { QFile file(fileInfo.absoluteFilePath()); @@ -175,7 +175,7 @@ VersionFilePtr OneSixVersionBuilder::parseJsonFile(const QFileInfo &fileInfo, // info.").arg(file.fileName()); } -QMap OneSixVersionBuilder::readOverrideOrders(OneSixInstance *instance) +QMap VersionBuilder::readOverrideOrders(OneSixInstance *instance) { QMap out; @@ -225,7 +225,7 @@ QMap OneSixVersionBuilder::readOverrideOrders(OneSixInstance *inst return out; } -bool OneSixVersionBuilder::writeOverrideOrders(const QMap &order, +bool VersionBuilder::writeOverrideOrders(const QMap &order, OneSixInstance *instance) { QJsonObject obj; diff --git a/logic/minecraft/OneSixVersionBuilder.h b/logic/minecraft/VersionBuilder.h similarity index 96% rename from logic/minecraft/OneSixVersionBuilder.h rename to logic/minecraft/VersionBuilder.h index 6646584ef..ac93ef118 100644 --- a/logic/minecraft/OneSixVersionBuilder.h +++ b/logic/minecraft/VersionBuilder.h @@ -24,9 +24,9 @@ class OneSixInstance; class QJsonObject; class QFileInfo; -class OneSixVersionBuilder +class VersionBuilder { - OneSixVersionBuilder(); + VersionBuilder(); public: static void build(VersionFinal *version, OneSixInstance *instance, const QStringList &external); static void readJsonAndApplyToVersion(VersionFinal *version, const QJsonObject &obj); diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp index a011ce1a1..e1b03e6c2 100644 --- a/logic/minecraft/VersionFile.cpp +++ b/logic/minecraft/VersionFile.cpp @@ -7,111 +7,28 @@ #include "logic/minecraft/VersionFile.h" #include "logic/minecraft/OneSixLibrary.h" #include "logic/minecraft/VersionFinal.h" -#include "logic/MMCJson.h" +#include "logic/minecraft/JarMod.h" +#include "logic/MMCJson.h" using namespace MMCJson; #define CURRENT_MINIMUM_LAUNCHER_VERSION 14 -JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename) +int findLibrary(QList haystack, const QString &needle) { - JarmodPtr out(new Jarmod()); - if (!libObj.contains("name")) + int retval = -1; + for (int i = 0; i < haystack.size(); ++i) { - throw JSONValidationError(filename + - "contains a jarmod that doesn't have a 'name' field"); - } - out->name = libObj.value("name").toString(); - - auto readString = [libObj, filename](const QString & key, QString & variable) - { - if (libObj.contains(key)) + QString chunk = haystack.at(i)->rawName(); + if (QRegExp(needle, Qt::CaseSensitive, QRegExp::WildcardUnix).indexIn(chunk) != -1) { - QJsonValue val = libObj.value(key); - if (!val.isString()) - { - QLOG_WARN() << key << "is not a string in" << filename << "(skipping)"; - } - else - { - variable = val.toString(); - } - } - }; - - readString("url", out->baseurl); - readString("MMC-absoluteUrl", out->absoluteUrl); - if(!out->baseurl.isEmpty() && out->absoluteUrl.isEmpty()) - { - out->absoluteUrl = out->baseurl + out->name; - } - return out; - -} - - -RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &filename) -{ - RawLibraryPtr out(new RawLibrary()); - if (!libObj.contains("name")) - { - throw JSONValidationError(filename + - "contains a library that doesn't have a 'name' field"); - } - out->name = libObj.value("name").toString(); - - auto readString = [libObj, filename](const QString & key, QString & variable) - { - if (libObj.contains(key)) - { - QJsonValue val = libObj.value(key); - if (!val.isString()) - { - QLOG_WARN() << key << "is not a string in" << filename << "(skipping)"; - } - else - { - variable = val.toString(); - } - } - }; - - readString("url", out->url); - readString("MMC-hint", out->hint); - readString("MMC-absulute_url", out->absoluteUrl); - readString("MMC-absoluteUrl", out->absoluteUrl); - if (libObj.contains("extract")) - { - out->applyExcludes = true; - auto extractObj = ensureObject(libObj.value("extract")); - for (auto excludeVal : ensureArray(extractObj.value("exclude"))) - { - out->excludes.append(ensureString(excludeVal)); + // only one is allowed. + if(retval != -1) + return -1; + retval = i; } } - if (libObj.contains("natives")) - { - out->applyNatives = true; - QJsonObject nativesObj = ensureObject(libObj.value("natives")); - for (auto it = nativesObj.begin(); it != nativesObj.end(); ++it) - { - if (!it.value().isString()) - { - QLOG_WARN() << filename << "contains an invalid native (skipping)"; - } - OpSys opSys = OpSys_fromString(it.key()); - if (opSys != Os_Other) - { - out->natives.append(qMakePair(opSys, it.value().toString())); - } - } - } - if (libObj.contains("rules")) - { - out->applyRules = true; - out->rules = rulesFromJsonV4(libObj); - } - return out; + return retval; } VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &filename, @@ -351,23 +268,6 @@ OneSixLibraryPtr VersionFile::createLibrary(RawLibraryPtr lib) return out; } -int VersionFile::findLibrary(QList haystack, const QString &needle) -{ - int retval = -1; - for (int i = 0; i < haystack.size(); ++i) - { - QString chunk = haystack.at(i)->rawName(); - if (QRegExp(needle, Qt::CaseSensitive, QRegExp::WildcardUnix).indexIn(chunk) != -1) - { - // only one is allowed. - if(retval != -1) - return -1; - retval = i; - } - } - return retval; -} - bool VersionFile::isVanilla() { return fileId == "org.multimc.version.json"; diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h index 8234445b6..82b169138 100644 --- a/logic/minecraft/VersionFile.h +++ b/logic/minecraft/VersionFile.h @@ -5,10 +5,14 @@ #include #include "logic/minecraft/OpSys.h" #include "logic/minecraft/OneSixRule.h" +#include "VersionPatch.h" #include "MMCError.h" +#include "RawLibrary.h" +#include "JarMod.h" class VersionFinal; + class VersionBuildError : public MMCError { public: @@ -46,66 +50,19 @@ public: virtual ~MinecraftVersionMismatch() noexcept {} }; -struct RawLibrary; -typedef std::shared_ptr RawLibraryPtr; -struct RawLibrary -{ - QString name; - QString url; - QString hint; - QString absoluteUrl; - bool applyExcludes = false; - QStringList excludes; - bool applyNatives = false; - QList> natives; - bool applyRules = false; - QList> rules; - - // user for '+' libraries - enum InsertType - { - Apply, - Append, - Prepend, - Replace - }; - InsertType insertType = Append; - QString insertData; - enum DependType - { - Soft, - Hard - }; - DependType dependType = Soft; - - static RawLibraryPtr fromJson(const QJsonObject &libObj, const QString &filename); -}; - -struct Jarmod; -typedef std::shared_ptr JarmodPtr; -struct Jarmod -{ - QString name; - QString baseurl; - QString hint; - QString absoluteUrl; - - static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename); -}; - struct VersionFile; typedef std::shared_ptr VersionFilePtr; -struct VersionFile +class VersionFile : public VersionPatch { public: /* methods */ static VersionFilePtr fromJson(const QJsonDocument &doc, const QString &filename, const bool requireOrder, const bool isFTB = false); static OneSixLibraryPtr createLibrary(RawLibraryPtr lib); - int findLibrary(QList haystack, const QString &needle); - void applyTo(VersionFinal *version); - bool isVanilla(); - bool hasJarMods(); + virtual void applyTo(VersionFinal *version) override; + virtual bool isVanilla() override; + virtual bool hasJarMods() override; + public: /* data */ int order = 0; QString name; @@ -143,3 +100,5 @@ public: /* data */ QList jarMods; }; + + diff --git a/logic/minecraft/VersionFinal.cpp b/logic/minecraft/VersionFinal.cpp index fbf6a1609..07f58778c 100644 --- a/logic/minecraft/VersionFinal.cpp +++ b/logic/minecraft/VersionFinal.cpp @@ -19,7 +19,7 @@ #include #include "logic/minecraft/VersionFinal.h" -#include "logic/minecraft/OneSixVersionBuilder.h" +#include "logic/minecraft/VersionBuilder.h" #include "logic/OneSixInstance.h" VersionFinal::VersionFinal(OneSixInstance *instance, QObject *parent) @@ -31,7 +31,7 @@ VersionFinal::VersionFinal(OneSixInstance *instance, QObject *parent) void VersionFinal::reload(const QStringList &external) { beginResetModel(); - OneSixVersionBuilder::build(this, m_instance, external); + VersionBuilder::build(this, m_instance, external); reapply(true); endResetModel(); } @@ -116,7 +116,7 @@ QString VersionFinal::versionFileId(const int index) const return versionFiles.at(index)->fileId; } -VersionFilePtr VersionFinal::versionFile(const QString &id) +VersionFilePtr VersionFinal::versionPatch(const QString &id) { for (auto file : versionFiles) { @@ -135,7 +135,7 @@ bool VersionFinal::hasJarMods() bool VersionFinal::hasFtbPack() { - return versionFile("org.multimc.ftb.pack.json") != nullptr; + return versionPatch("org.multimc.ftb.pack.json") != nullptr; } bool VersionFinal::removeFtbPack() @@ -216,7 +216,7 @@ std::shared_ptr VersionFinal::fromJson(const QJsonObject &obj) std::shared_ptr version(new VersionFinal(0)); try { - OneSixVersionBuilder::readJsonAndApplyToVersion(version.get(), obj); + VersionBuilder::readJsonAndApplyToVersion(version.get(), obj); } catch(MMCError & err) { @@ -299,7 +299,7 @@ QMap VersionFinal::getExistingOrder() const } // overriden { - QMap overridenOrder = OneSixVersionBuilder::readOverrideOrders(m_instance); + QMap overridenOrder = VersionBuilder::readOverrideOrders(m_instance); for (auto id : order.keys()) { if (overridenOrder.contains(id)) @@ -348,7 +348,7 @@ void VersionFinal::move(const int index, const MoveDirection direction) order[ourId] = theirIndex; order[theirId] = index; - if (!OneSixVersionBuilder::writeOverrideOrders(order, m_instance)) + if (!VersionBuilder::writeOverrideOrders(order, m_instance)) { throw MMCError(tr("Couldn't save the new order")); } @@ -378,7 +378,7 @@ void VersionFinal::reapply(const bool alreadyReseting) QList newVersionFiles; for (auto order : orders) { - auto file = versionFile(existingOrders.key(order)); + auto file = versionPatch(existingOrders.key(order)); newVersionFiles.append(file); file->applyTo(this); } diff --git a/logic/minecraft/VersionFinal.h b/logic/minecraft/VersionFinal.h index ceb90f57c..7be981ed4 100644 --- a/logic/minecraft/VersionFinal.h +++ b/logic/minecraft/VersionFinal.h @@ -23,6 +23,7 @@ #include "OneSixLibrary.h" #include "VersionFile.h" +#include "JarMod.h" class OneSixInstance; @@ -164,7 +165,7 @@ public: // QList rules; QList versionFiles; - VersionFilePtr versionFile(const QString &id); + VersionFilePtr versionPatch(const QString &id); private: OneSixInstance *m_instance; diff --git a/logic/minecraft/VersionPatch.h b/logic/minecraft/VersionPatch.h new file mode 100644 index 000000000..c22587874 --- /dev/null +++ b/logic/minecraft/VersionPatch.h @@ -0,0 +1,15 @@ +#pragma once + +#include + +class VersionFinal; +class VersionPatch +{ +public: + virtual ~VersionPatch(){}; + virtual void applyTo(VersionFinal *version) = 0; + virtual bool isVanilla() = 0; + virtual bool hasJarMods() = 0; +}; + +typedef std::shared_ptr VersionPatchPtr;