Properly detect if the instance is vanilla and don't treat it as custom.
This commit is contained in:
parent
fd6706391b
commit
814d5d3315
@ -157,8 +157,11 @@ bool InstanceVersion::removeFtbPack()
|
|||||||
bool InstanceVersion::isVanilla()
|
bool InstanceVersion::isVanilla()
|
||||||
{
|
{
|
||||||
QDir patches(PathCombine(m_instance->instanceRoot(), "patches/"));
|
QDir patches(PathCombine(m_instance->instanceRoot(), "patches/"));
|
||||||
if(VersionPatches.size() >= 1)
|
for(auto patchptr: VersionPatches)
|
||||||
return false;
|
{
|
||||||
|
if(patchptr->isCustom())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json")))
|
if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json")))
|
||||||
return false;
|
return false;
|
||||||
if(QFile::exists(PathCombine(m_instance->instanceRoot(), "version.json")))
|
if(QFile::exists(PathCombine(m_instance->instanceRoot(), "version.json")))
|
||||||
|
@ -155,3 +155,9 @@ bool MinecraftVersion::hasUpdate()
|
|||||||
{
|
{
|
||||||
return m_versionSource == Remote || (m_versionSource == Local && upstreamUpdate);
|
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;
|
||||||
|
}
|
||||||
|
@ -47,6 +47,7 @@ public: /* methods */
|
|||||||
virtual QString getPatchFilename() override;
|
virtual QString getPatchFilename() override;
|
||||||
bool needsUpdate();
|
bool needsUpdate();
|
||||||
bool hasUpdate();
|
bool hasUpdate();
|
||||||
|
virtual bool isCustom();
|
||||||
|
|
||||||
private: /* methods */
|
private: /* methods */
|
||||||
void applyFileTo(InstanceVersion *version);
|
void applyFileTo(InstanceVersion *version);
|
||||||
|
@ -199,6 +199,7 @@ void VersionBuilder::buildFromMultilayer()
|
|||||||
throw VersionIncomplete("org.lwjgl");
|
throw VersionIncomplete("org.lwjgl");
|
||||||
}
|
}
|
||||||
lwjglPatch->setOrder(-1);
|
lwjglPatch->setOrder(-1);
|
||||||
|
lwjgl->setVanilla(true);
|
||||||
m_version->VersionPatches.append(lwjglPatch);
|
m_version->VersionPatches.append(lwjglPatch);
|
||||||
|
|
||||||
// load all patches, put into map for ordering, apply in the right order
|
// load all patches, put into map for ordering, apply in the right order
|
||||||
|
@ -53,9 +53,18 @@ public: /* methods */
|
|||||||
{
|
{
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
virtual bool isCustom()
|
||||||
|
{
|
||||||
|
return !isVanilla;
|
||||||
|
};
|
||||||
|
void setVanilla (bool state)
|
||||||
|
{
|
||||||
|
isVanilla = state;
|
||||||
|
}
|
||||||
|
|
||||||
public: /* data */
|
public: /* data */
|
||||||
int order = 0;
|
int order = 0;
|
||||||
|
bool isVanilla = false;
|
||||||
QString name;
|
QString name;
|
||||||
QString fileId;
|
QString fileId;
|
||||||
QString version;
|
QString version;
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
virtual QString getPatchName() = 0;
|
virtual QString getPatchName() = 0;
|
||||||
virtual QString getPatchVersion() = 0;
|
virtual QString getPatchVersion() = 0;
|
||||||
virtual QString getPatchFilename() = 0;
|
virtual QString getPatchFilename() = 0;
|
||||||
|
virtual bool isCustom() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<VersionPatch> VersionPatchPtr;
|
typedef std::shared_ptr<VersionPatch> VersionPatchPtr;
|
||||||
|
Loading…
Reference in New Issue
Block a user