feat: add support for Quilt Loader in Modrinth packs

This commit is contained in:
Sefa Eyeoglu 2022-05-15 12:06:01 +02:00
parent 9731e06728
commit a43f882d48
No known key found for this signature in database
GPG Key ID: C10411294912A422

View File

@ -480,7 +480,7 @@ void InstanceImportTask::processMultiMC()
void InstanceImportTask::processModrinth() { void InstanceImportTask::processModrinth() {
std::vector<Modrinth::File> files; std::vector<Modrinth::File> files;
QString minecraftVersion, fabricVersion, forgeVersion; QString minecraftVersion, fabricVersion, quiltVersion, forgeVersion;
try try
{ {
QString indexPath = FS::PathCombine(m_stagingPath, "modrinth.index.json"); QString indexPath = FS::PathCombine(m_stagingPath, "modrinth.index.json");
@ -547,6 +547,12 @@ void InstanceImportTask::processModrinth() {
throw JSONValidationError("Duplicate Fabric Loader version"); throw JSONValidationError("Duplicate Fabric Loader version");
fabricVersion = Json::requireString(*it, "Fabric Loader version"); fabricVersion = Json::requireString(*it, "Fabric Loader version");
} }
else if (name == "quilt-loader")
{
if (!quiltVersion.isEmpty())
throw JSONValidationError("Duplicate Quilt Loader version");
quiltVersion = Json::requireString(*it, "Quilt Loader version");
}
else if (name == "forge") else if (name == "forge")
{ {
if (!forgeVersion.isEmpty()) if (!forgeVersion.isEmpty())
@ -587,6 +593,8 @@ void InstanceImportTask::processModrinth() {
components->setComponentVersion("net.minecraft", minecraftVersion, true); components->setComponentVersion("net.minecraft", minecraftVersion, true);
if (!fabricVersion.isEmpty()) if (!fabricVersion.isEmpty())
components->setComponentVersion("net.fabricmc.fabric-loader", fabricVersion, true); components->setComponentVersion("net.fabricmc.fabric-loader", fabricVersion, true);
if (!quiltVersion.isEmpty())
components->setComponentVersion("org.quiltmc.quilt-loader", quiltVersion, true);
if (!forgeVersion.isEmpty()) if (!forgeVersion.isEmpty())
components->setComponentVersion("net.minecraftforge", forgeVersion, true); components->setComponentVersion("net.minecraftforge", forgeVersion, true);
if (m_instIcon != "default") if (m_instIcon != "default")