diff --git a/logic/minecraft/InstanceVersion.cpp b/logic/minecraft/InstanceVersion.cpp index addbcc84..c345e1fb 100644 --- a/logic/minecraft/InstanceVersion.cpp +++ b/logic/minecraft/InstanceVersion.cpp @@ -157,8 +157,11 @@ bool InstanceVersion::removeFtbPack() bool InstanceVersion::isVanilla() { QDir patches(PathCombine(m_instance->instanceRoot(), "patches/")); - if(VersionPatches.size() >= 1) - return false; + for(auto patchptr: VersionPatches) + { + if(patchptr->isCustom()) + return false; + } if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json"))) return false; if(QFile::exists(PathCombine(m_instance->instanceRoot(), "version.json"))) diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp index 8368c430..939c1149 100644 --- a/logic/minecraft/MinecraftVersion.cpp +++ b/logic/minecraft/MinecraftVersion.cpp @@ -155,3 +155,9 @@ bool MinecraftVersion::hasUpdate() { return m_versionSource == Remote || (m_versionSource == Local && upstreamUpdate); } + +bool MinecraftVersion::isCustom() +{ + // if we add any other source types, this will evaluate to false for them. + return m_versionSource != Builtin && m_versionSource != Local && m_versionSource != Remote; +} diff --git a/logic/minecraft/MinecraftVersion.h b/logic/minecraft/MinecraftVersion.h index e06dadb1..152eeb8a 100644 --- a/logic/minecraft/MinecraftVersion.h +++ b/logic/minecraft/MinecraftVersion.h @@ -47,6 +47,7 @@ public: /* methods */ virtual QString getPatchFilename() override; bool needsUpdate(); bool hasUpdate(); + virtual bool isCustom(); private: /* methods */ void applyFileTo(InstanceVersion *version); diff --git a/logic/minecraft/VersionBuilder.cpp b/logic/minecraft/VersionBuilder.cpp index fea0c8d1..dbaf5257 100644 --- a/logic/minecraft/VersionBuilder.cpp +++ b/logic/minecraft/VersionBuilder.cpp @@ -199,6 +199,7 @@ void VersionBuilder::buildFromMultilayer() throw VersionIncomplete("org.lwjgl"); } lwjglPatch->setOrder(-1); + lwjgl->setVanilla(true); m_version->VersionPatches.append(lwjglPatch); // load all patches, put into map for ordering, apply in the right order diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h index 9a6c5d3c..96856891 100644 --- a/logic/minecraft/VersionFile.h +++ b/logic/minecraft/VersionFile.h @@ -53,9 +53,18 @@ public: /* methods */ { return filename; } + virtual bool isCustom() + { + return !isVanilla; + }; + void setVanilla (bool state) + { + isVanilla = state; + } public: /* data */ int order = 0; + bool isVanilla = false; QString name; QString fileId; QString version; diff --git a/logic/minecraft/VersionPatch.h b/logic/minecraft/VersionPatch.h index 1dd30e79..6c7bd7cf 100644 --- a/logic/minecraft/VersionPatch.h +++ b/logic/minecraft/VersionPatch.h @@ -26,6 +26,7 @@ public: virtual QString getPatchName() = 0; virtual QString getPatchVersion() = 0; virtual QString getPatchFilename() = 0; + virtual bool isCustom() = 0; }; typedef std::shared_ptr VersionPatchPtr;