feat: support NeoForge mrpack modpacks

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-08-06 21:07:24 +02:00
parent 52e5ee7111
commit 01c3750835
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951
3 changed files with 8 additions and 1 deletions

View File

@ -211,6 +211,8 @@ bool ModrinthCreationTask::createInstance()
components->setComponentVersion("org.quiltmc.quilt-loader", m_quilt_version); components->setComponentVersion("org.quiltmc.quilt-loader", m_quilt_version);
if (!m_forge_version.isEmpty()) if (!m_forge_version.isEmpty())
components->setComponentVersion("net.minecraftforge", m_forge_version); components->setComponentVersion("net.minecraftforge", m_forge_version);
if (!m_neoForge_version.isEmpty())
components->setComponentVersion("net.neoforged", m_neoForge_version);
if (m_instIcon != "default") { if (m_instIcon != "default") {
instance.setIconKey(m_instIcon); instance.setIconKey(m_instIcon);
@ -398,6 +400,8 @@ bool ModrinthCreationTask::parseManifest(const QString& index_path,
m_quilt_version = Json::requireString(*it, "Quilt Loader version"); m_quilt_version = Json::requireString(*it, "Quilt Loader version");
} else if (name == "forge") { } else if (name == "forge") {
m_forge_version = Json::requireString(*it, "Forge version"); m_forge_version = Json::requireString(*it, "Forge version");
} else if (name == "neoforge") {
m_neoForge_version = Json::requireString(*it, "NeoForge version");
} else { } else {
throw JSONValidationError("Unknown dependency type: " + name); throw JSONValidationError("Unknown dependency type: " + name);
} }

View File

@ -39,7 +39,7 @@ class ModrinthCreationTask final : public InstanceCreationTask {
private: private:
QWidget* m_parent = nullptr; QWidget* m_parent = nullptr;
QString m_minecraft_version, m_fabric_version, m_quilt_version, m_forge_version; QString m_minecraft_version, m_fabric_version, m_quilt_version, m_forge_version, m_neoForge_version;
QString m_managed_id, m_managed_version_id, m_managed_name; QString m_managed_id, m_managed_version_id, m_managed_name;
std::vector<Modrinth::File> m_files; std::vector<Modrinth::File> m_files;

View File

@ -245,6 +245,7 @@ QByteArray ModrinthPackExportTask::generateIndex()
const ComponentPtr quilt = profile->getComponent("org.quiltmc.quilt-loader"); const ComponentPtr quilt = profile->getComponent("org.quiltmc.quilt-loader");
const ComponentPtr fabric = profile->getComponent("net.fabricmc.fabric-loader"); const ComponentPtr fabric = profile->getComponent("net.fabricmc.fabric-loader");
const ComponentPtr forge = profile->getComponent("net.minecraftforge"); const ComponentPtr forge = profile->getComponent("net.minecraftforge");
const ComponentPtr neoForge = profile->getComponent("net.neoforged");
// convert all available components to mrpack dependencies // convert all available components to mrpack dependencies
QJsonObject dependencies; QJsonObject dependencies;
@ -256,6 +257,8 @@ QByteArray ModrinthPackExportTask::generateIndex()
dependencies["fabric-loader"] = fabric->m_version; dependencies["fabric-loader"] = fabric->m_version;
if (forge != nullptr) if (forge != nullptr)
dependencies["forge"] = forge->m_version; dependencies["forge"] = forge->m_version;
if (neoForge != nullptr)
dependencies["neoforge"] = neoForge->m_version;
out["dependencies"] = dependencies; out["dependencies"] = dependencies;
} }