Merge pull request #3833 from jamierocks/disable-forge-btn-when-game-running

NOISSUE Disable 'Install Forge' button when game is running
This commit is contained in:
Petr Mrázek 2021-06-09 21:54:22 +02:00 committed by GitHub
commit 9fafe3ffe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 11 deletions

View File

@ -238,6 +238,7 @@ void InstanceImportTask::processFlame()
}
QString forgeVersion;
QString fabricVersion;
for(auto &loader: pack.minecraft.modLoaders)
{
auto id = loader.id;
@ -247,6 +248,12 @@ void InstanceImportTask::processFlame()
forgeVersion = id;
continue;
}
if(id.startsWith("fabric-"))
{
id.remove("fabric-");
fabricVersion = id;
continue;
}
logWarning(tr("Unknown mod loader in manifest: %1").arg(id));
}
@ -281,6 +288,10 @@ void InstanceImportTask::processFlame()
}
components->setComponentVersion("net.minecraftforge", forgeVersion);
}
if(!fabricVersion.isEmpty())
{
components->setComponentVersion("net.fabricmc.fabric-loader", fabricVersion);
}
if (m_instIcon != "default")
{
instance.setIconKey(m_instIcon);

View File

@ -109,12 +109,7 @@ void PackInstallTask::downloadPack()
connect(jobPtr.get(), &NetJob::failed, [&](QString reason)
{
jobPtr.reset();
// FIXME: Temporarily ignore file download failures (matching FTB's installer),
// while FTB's data is fucked.
qWarning() << "Failed to download files for modpack: " + reason;
install();
emitFailed(reason);
});
connect(jobPtr.get(), &NetJob::progress, [&](qint64 current, qint64 total)
{

View File

@ -203,11 +203,11 @@ void VersionPage::updateVersionControls()
{
// FIXME: this is a dirty hack
auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft"));
bool newCraft = controlsEnabled && (minecraftVersion >= Version("1.14"));
bool oldCraft = controlsEnabled && (minecraftVersion <= Version("1.12.2"));
ui->actionInstall_Fabric->setEnabled(newCraft);
ui->actionInstall_Forge->setEnabled(true);
ui->actionInstall_LiteLoader->setEnabled(oldCraft);
bool newCraft = minecraftVersion >= Version("1.14");
bool oldCraft = minecraftVersion <= Version("1.12.2");
ui->actionInstall_Fabric->setEnabled(controlsEnabled && newCraft);
ui->actionInstall_Forge->setEnabled(controlsEnabled);
ui->actionInstall_LiteLoader->setEnabled(controlsEnabled && oldCraft);
ui->actionReload->setEnabled(true);
updateButtons();
}