Skip to content

Commit

Permalink
Merge branch 'MultiMC:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Neptune650 authored Mar 16, 2024
2 parents e425abf + 0912669 commit 2bd0d5d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
12 changes: 10 additions & 2 deletions launcher/InstanceImportTask.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2013-2021 MultiMC Contributors
/* Copyright 2013-2024 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -293,7 +293,7 @@ bool mergeOverrides(const QString &fromDir, const QString &toDir) {

void InstanceImportTask::processModrinth() {
std::vector<Modrinth::File> files;
QString minecraftVersion, fabricVersion, quiltVersion, forgeVersion;
QString minecraftVersion, fabricVersion, quiltVersion, forgeVersion, neoforgeVersion;
try
{
QString indexPath = FS::PathCombine(m_stagingPath, "modrinth.index.json");
Expand Down Expand Up @@ -392,6 +392,12 @@ void InstanceImportTask::processModrinth() {
throw JSONValidationError("Duplicate Forge version");
forgeVersion = Json::requireValueString(*it, "Forge version");
}
else if (name == "neoforge")
{
if (!neoforgeVersion.isEmpty())
throw JSONValidationError("Duplicate NeoForge version");
neoforgeVersion = Json::requireValueString(*it, "NeoForge version");
}
else
{
throw JSONValidationError("Unknown dependency type: " + name);
Expand Down Expand Up @@ -446,6 +452,8 @@ void InstanceImportTask::processModrinth() {
components->setComponentVersion("org.quiltmc.quilt-loader", quiltVersion, true);
if (!forgeVersion.isEmpty())
components->setComponentVersion("net.minecraftforge", forgeVersion, true);
if (!neoforgeVersion.isEmpty())
components->setComponentVersion("net.neoforged", neoforgeVersion, true);
if (m_instIcon != "default")
{
instance.setIconKey(m_instIcon);
Expand Down
5 changes: 4 additions & 1 deletion launcher/modplatform/modrinth/ModrinthInstanceExportTask.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 arthomnix
* Copyright 2023-2024 arthomnix
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the COPYING.md file for more information.
Expand Down Expand Up @@ -213,6 +213,9 @@ void InstanceExportTask::lookupSucceeded()
if (!m_settings.quiltVersion.isEmpty()) {
dependencies.insert("quilt-loader", m_settings.quiltVersion);
}
if (!m_settings.neoforgeVersion.isEmpty()) {
dependencies.insert("neoforge", m_settings.neoforgeVersion);
}

indexJson.insert("dependencies", dependencies);

Expand Down
3 changes: 2 additions & 1 deletion launcher/modplatform/modrinth/ModrinthInstanceExportTask.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 arthomnix
* Copyright 2023-2024 arthomnix
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the COPYING.md file for more information.
Expand Down Expand Up @@ -33,6 +33,7 @@ struct ExportSettings
QString forgeVersion;
QString fabricVersion;
QString quiltVersion;
QString neoforgeVersion;

QString exportPath;
};
Expand Down
3 changes: 2 additions & 1 deletion launcher/ui/dialogs/ModrinthExportDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 arthomnix
* Copyright 2023-2024 arthomnix
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the COPYING.md file for more information.
Expand Down Expand Up @@ -107,6 +107,7 @@ void ModrinthExportDialog::accept()
settings.forgeVersion = minecraftInstance->getPackProfile()->getComponentVersion("net.minecraftforge");
settings.fabricVersion = minecraftInstance->getPackProfile()->getComponentVersion("net.fabricmc.fabric-loader");
settings.quiltVersion = minecraftInstance->getPackProfile()->getComponentVersion("org.quiltmc.quilt-loader");
settings.neoforgeVersion = minecraftInstance->getPackProfile()->getComponentVersion("net.neoforged");

settings.exportPath = ui->file->text();

Expand Down

0 comments on commit 2bd0d5d

Please sign in to comment.