diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp index 449172920..5db3c307a 100644 --- a/launcher/ui/pages/instance/VersionPage.cpp +++ b/launcher/ui/pages/instance/VersionPage.cpp @@ -444,6 +444,35 @@ void VersionPage::on_actionInstall_Forge_triggered() } } +void VersionPage::on_actionInstall_NeoForge_triggered() +{ + auto vlist = APPLICATION->metadataIndex()->get("net.neoforged"); + if(!vlist) + { + return; + } + VersionSelectDialog vselect(vlist.get(), tr("Select NeoForge version"), this); + vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft")); + vselect.setEmptyString(tr("No NeoForge versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft")); + vselect.setEmptyErrorString(tr("Couldn't load or download the NeoForge version lists!")); + + auto currentVersion = m_profile->getComponentVersion("net.neoforged"); + if(!currentVersion.isEmpty()) + { + vselect.setCurrentVersion(currentVersion); + } + + if (vselect.exec() && vselect.selectedVersion()) + { + auto vsn = vselect.selectedVersion(); + m_profile->setComponentVersion("net.neoforged", vsn->descriptor()); + m_profile->resolve(Net::Mode::Online); + // m_profile->installVersion(); + preselect(m_profile->rowCount(QModelIndex())-1); + m_container->refreshContainer(); + } +} + void VersionPage::on_actionInstall_Fabric_triggered() { auto vlist = APPLICATION->metadataIndex()->get("net.fabricmc.fabric-loader"); diff --git a/launcher/ui/pages/instance/VersionPage.h b/launcher/ui/pages/instance/VersionPage.h index 9045d4ad1..2f89bea10 100644 --- a/launcher/ui/pages/instance/VersionPage.h +++ b/launcher/ui/pages/instance/VersionPage.h @@ -51,6 +51,7 @@ class VersionPage : public QMainWindow, public BasePage private slots: void on_actionChange_version_triggered(); void on_actionInstall_Forge_triggered(); + void on_actionInstall_NeoForge_triggered(); void on_actionInstall_Fabric_triggered(); void on_actionInstall_Quilt_triggered(); void on_actionAdd_Empty_triggered(); diff --git a/launcher/ui/pages/instance/VersionPage.ui b/launcher/ui/pages/instance/VersionPage.ui index 489f72188..92f163608 100644 --- a/launcher/ui/pages/instance/VersionPage.ui +++ b/launcher/ui/pages/instance/VersionPage.ui @@ -106,6 +106,7 @@ + @@ -270,6 +271,14 @@ Open the instance's local libraries folder. + + + Install NeoForge + + + Install the NeoForge package. + +