Skip to content

Commit

Permalink
MultiMCGH-5232 Add Install NeoForge button (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthomnix committed Jan 10, 2024
1 parent 7450faa commit b69ab34
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
29 changes: 29 additions & 0 deletions launcher/ui/pages/instance/VersionPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions launcher/ui/pages/instance/VersionPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 9 additions & 0 deletions launcher/ui/pages/instance/VersionPage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<addaction name="actionRevert"/>
<addaction name="separator"/>
<addaction name="actionInstall_Forge"/>
<addaction name="actionInstall_NeoForge"/>
<addaction name="actionInstall_Fabric"/>
<addaction name="actionInstall_Quilt"/>
<addaction name="actionInstall_LiteLoader"/>
Expand Down Expand Up @@ -270,6 +271,14 @@
<string>Open the instance's local libraries folder.</string>
</property>
</action>
<action name="actionInstall_NeoForge">
<property name="text">
<string>Install NeoForge</string>
</property>
<property name="toolTip">
<string>Install the NeoForge package.</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down

0 comments on commit b69ab34

Please sign in to comment.