feat: initial Quilt support

This commit is contained in:
Sefa Eyeoglu 2022-02-20 17:51:26 +01:00
parent cc5261051f
commit 9eb9ddc668
No known key found for this signature in database
GPG Key ID: C10411294912A422
4 changed files with 49 additions and 0 deletions

View File

@ -600,6 +600,15 @@ void ComponentUpdateTask::resolveDependencies(bool checkOnly)
component->m_version = (*minecraft)->getVersion(); component->m_version = (*minecraft)->getVersion();
} }
} }
else if (add.uid == "org.quiltmc.quilt-mappings")
{
auto minecraft = std::find_if(components.begin(), components.end(), [](ComponentPtr & cmp){
return cmp->getID() == "net.minecraft";
});
if(minecraft != components.end()) {
component->m_version = (*minecraft)->getVersion() + "+build.1";
}
}
} }
// HACK HACK HACK HACK FIXME: this is a placeholder for deciding what version to use. For now, it is hardcoded. // HACK HACK HACK HACK FIXME: this is a placeholder for deciding what version to use. For now, it is hardcoded.
// ############################################################################################################ // ############################################################################################################

View File

@ -243,6 +243,9 @@ void VersionPage::updateVersionControls()
bool supportsFabric = minecraftVersion >= Version("1.14"); bool supportsFabric = minecraftVersion >= Version("1.14");
ui->actionInstall_Fabric->setEnabled(controlsEnabled && supportsFabric); ui->actionInstall_Fabric->setEnabled(controlsEnabled && supportsFabric);
bool supportsQuilt = minecraftVersion >= Version("1.17.1");
ui->actionInstall_Quilt->setEnabled(controlsEnabled && supportsQuilt);
bool supportsLiteLoader = minecraftVersion <= Version("1.12.2"); bool supportsLiteLoader = minecraftVersion <= Version("1.12.2");
ui->actionInstall_LiteLoader->setEnabled(controlsEnabled && supportsLiteLoader); ui->actionInstall_LiteLoader->setEnabled(controlsEnabled && supportsLiteLoader);
@ -498,6 +501,33 @@ void VersionPage::on_actionInstall_Fabric_triggered()
} }
} }
void VersionPage::on_actionInstall_Quilt_triggered()
{
auto vlist = APPLICATION->metadataIndex()->get("org.quiltmc.quilt-loader");
if(!vlist)
{
return;
}
VersionSelectDialog vselect(vlist.get(), tr("Select Quilt Loader version"), this);
vselect.setEmptyString(tr("No Quilt Loader versions are currently available."));
vselect.setEmptyErrorString(tr("Couldn't load or download the Quilt Loader version lists!"));
auto currentVersion = m_profile->getComponentVersion("org.quiltmc.quilt-loader");
if(!currentVersion.isEmpty())
{
vselect.setCurrentVersion(currentVersion);
}
if (vselect.exec() && vselect.selectedVersion())
{
auto vsn = vselect.selectedVersion();
m_profile->setComponentVersion("org.quiltmc.quilt-loader", vsn->descriptor());
m_profile->resolve(Net::Mode::Online);
preselect(m_profile->rowCount(QModelIndex())-1);
m_container->refreshContainer();
}
}
void VersionPage::on_actionAdd_Empty_triggered() void VersionPage::on_actionAdd_Empty_triggered()
{ {
NewComponentDialog compdialog(QString(), QString(), this); NewComponentDialog compdialog(QString(), QString(), this);

View File

@ -73,6 +73,7 @@ private slots:
void on_actionChange_version_triggered(); void on_actionChange_version_triggered();
void on_actionInstall_Forge_triggered(); void on_actionInstall_Forge_triggered();
void on_actionInstall_Fabric_triggered(); void on_actionInstall_Fabric_triggered();
void on_actionInstall_Quilt_triggered();
void on_actionAdd_Empty_triggered(); void on_actionAdd_Empty_triggered();
void on_actionInstall_LiteLoader_triggered(); void on_actionInstall_LiteLoader_triggered();
void on_actionReload_triggered(); void on_actionReload_triggered();

View File

@ -107,6 +107,7 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionInstall_Forge"/> <addaction name="actionInstall_Forge"/>
<addaction name="actionInstall_Fabric"/> <addaction name="actionInstall_Fabric"/>
<addaction name="actionInstall_Quilt"/>
<addaction name="actionInstall_LiteLoader"/> <addaction name="actionInstall_LiteLoader"/>
<addaction name="actionInstall_mods"/> <addaction name="actionInstall_mods"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -192,6 +193,14 @@
<string>Install the Fabric Loader package.</string> <string>Install the Fabric Loader package.</string>
</property> </property>
</action> </action>
<action name="actionInstall_Quilt">
<property name="text">
<string>Install Quilt</string>
</property>
<property name="toolTip">
<string>Install the Quilt Loader package.</string>
</property>
</action>
<action name="actionInstall_LiteLoader"> <action name="actionInstall_LiteLoader">
<property name="text"> <property name="text">
<string>Install LiteLoader</string> <string>Install LiteLoader</string>