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()
|
||||
{
|
||||
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")))
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public: /* methods */
|
||||
virtual QString getPatchFilename() override;
|
||||
bool needsUpdate();
|
||||
bool hasUpdate();
|
||||
virtual bool isCustom();
|
||||
|
||||
private: /* methods */
|
||||
void applyFileTo(InstanceVersion *version);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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<VersionPatch> VersionPatchPtr;
|
||||
|
Loading…
Reference in New Issue
Block a user