Sync from quickmods
This commit is contained in:
@ -264,6 +264,14 @@ QList<std::shared_ptr<OneSixLibrary> > InstanceVersion::getActiveNormalLibs()
|
||||
{
|
||||
if (lib->isActive() && !lib->isNative())
|
||||
{
|
||||
for (auto other : output)
|
||||
{
|
||||
if (other->rawName() == lib->rawName())
|
||||
{
|
||||
QLOG_WARN() << "Multiple libraries with name" << lib->rawName() << "in library list!";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
output.append(lib);
|
||||
}
|
||||
}
|
||||
|
@ -140,10 +140,10 @@ public:
|
||||
QString appletClass;
|
||||
|
||||
/// the list of libs - both active and inactive, native and java
|
||||
QList<std::shared_ptr<OneSixLibrary>> libraries;
|
||||
|
||||
QList<OneSixLibraryPtr> libraries;
|
||||
|
||||
/// same, but only vanilla.
|
||||
QList<std::shared_ptr<OneSixLibrary>> vanillaLibraries;
|
||||
QList<OneSixLibraryPtr> vanillaLibraries;
|
||||
|
||||
/// traits, collected from all the version files (version files can only add)
|
||||
QSet<QString> traits;
|
||||
|
@ -116,15 +116,10 @@ void MinecraftVersionList::loadBuiltinList()
|
||||
{
|
||||
QLOG_INFO() << "Loading builtin version list.";
|
||||
// grab the version list data from internal resources.
|
||||
QResource versionList(":/versions/minecraft.json");
|
||||
QFile filez(versionList.absoluteFilePath());
|
||||
filez.open(QIODevice::ReadOnly);
|
||||
auto data = filez.readAll();
|
||||
|
||||
// parse the data as json
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError);
|
||||
QJsonObject root = jsonDoc.object();
|
||||
const QJsonDocument doc =
|
||||
MMCJson::parseFile(":/versions/minecraft.json",
|
||||
"builtin version list");
|
||||
const QJsonObject root = doc.object();
|
||||
|
||||
// parse all the versions
|
||||
for (const auto version : MMCJson::ensureArray(root.value("versions")))
|
||||
|
@ -48,5 +48,4 @@ public:
|
||||
/// Constructor
|
||||
OneSixLibrary(RawLibraryPtr base);
|
||||
static OneSixLibraryPtr fromRawLibrary(RawLibraryPtr lib);
|
||||
|
||||
};
|
||||
|
@ -288,6 +288,11 @@ static const int currentOrderFileVersion = 1;
|
||||
bool VersionBuilder::readOverrideOrders(OneSixInstance *instance, PatchOrder &order)
|
||||
{
|
||||
QFile orderFile(instance->instanceRoot() + "/order.json");
|
||||
if (!orderFile.exists())
|
||||
{
|
||||
QLOG_WARN() << "Order file doesn't exist. Ignoring.";
|
||||
return false;
|
||||
}
|
||||
if (!orderFile.open(QFile::ReadOnly))
|
||||
{
|
||||
QLOG_ERROR() << "Couldn't open" << orderFile.fileName()
|
||||
|
@ -22,8 +22,7 @@ int findLibraryByName(QList<OneSixLibraryPtr> haystack, const GradleSpecifier &n
|
||||
int retval = -1;
|
||||
for (int i = 0; i < haystack.size(); ++i)
|
||||
{
|
||||
|
||||
if(haystack.at(i)->rawName().matchName(needle))
|
||||
if (haystack.at(i)->rawName().matchName(needle))
|
||||
{
|
||||
// only one is allowed.
|
||||
if (retval != -1)
|
||||
@ -67,7 +66,7 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi
|
||||
out->mcVersion = root.value("mcVersion").toString();
|
||||
out->filename = filename;
|
||||
|
||||
auto readString = [root](const QString & key, QString & variable)
|
||||
auto readString = [root](const QString &key, QString &variable)
|
||||
{
|
||||
if (root.contains(key))
|
||||
{
|
||||
@ -75,15 +74,14 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi
|
||||
}
|
||||
};
|
||||
|
||||
auto readStringRet = [root](const QString & key)->QString
|
||||
auto readStringRet = [root](const QString &key) -> QString
|
||||
{
|
||||
if (root.contains(key))
|
||||
{
|
||||
return ensureString(root.value(key));
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
// FIXME: This should be ignored when applying.
|
||||
if (!isFTB)
|
||||
|
Reference in New Issue
Block a user