diff --git a/launcher/minecraft/VanillaInstanceCreationTask.cpp b/launcher/minecraft/VanillaInstanceCreationTask.cpp index 9625e985b..7af377953 100644 --- a/launcher/minecraft/VanillaInstanceCreationTask.cpp +++ b/launcher/minecraft/VanillaInstanceCreationTask.cpp @@ -19,21 +19,17 @@ bool VanillaCreationTask::createInstance() { setStatus(tr("Creating instance from version %1").arg(m_version->name())); - auto instance_settings = std::make_unique(FS::PathCombine(m_stagingPath, "instance.cfg")); - instance_settings->suspendSave(); - { - MinecraftInstance inst(m_globalSettings, std::move(instance_settings), m_stagingPath); - auto components = inst.getPackProfile(); - components->buildingFromScratch(); - components->setComponentVersion("net.minecraft", m_version->descriptor(), true); - if (m_using_loader) - components->setComponentVersion(m_loader, m_loader_version->descriptor()); + MinecraftInstance inst(m_globalSettings, std::make_unique(FS::PathCombine(m_stagingPath, "instance.cfg")), m_stagingPath); + SettingsObject::Lock lock(inst.settings()); - inst.setName(name()); - inst.setIconKey(m_instIcon); + auto components = inst.getPackProfile(); + components->buildingFromScratch(); + components->setComponentVersion("net.minecraft", m_version->descriptor(), true); + if (m_using_loader) + components->setComponentVersion(m_loader, m_loader_version->descriptor()); - inst.settings()->resumeSave(); - } + inst.setName(name()); + inst.setIconKey(m_instIcon); return true; } diff --git a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp index 66dc95503..df7a16a03 100644 --- a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp +++ b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp @@ -988,10 +988,9 @@ void PackInstallTask::install() setStatus(tr("Installing modpack")); auto instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg"); - auto instanceSettings = std::make_unique(instanceConfigPath); - instanceSettings->suspendSave(); + MinecraftInstance instance(m_globalSettings, std::make_unique(instanceConfigPath), m_stagingPath); + SettingsObject::Lock lock(instance.settings()); - MinecraftInstance instance(m_globalSettings, std::move(instanceSettings), m_stagingPath); auto components = instance.getPackProfile(); components->buildingFromScratch(); @@ -1047,7 +1046,6 @@ void PackInstallTask::install() instance.setName(name()); instance.setIconKey(m_instIcon); instance.setManagedPack("atlauncher", m_pack_safe_name, m_pack_name, m_version_name, m_version_name); - instance.settings()->resumeSave(); jarmods.clear(); emitSucceeded(); diff --git a/launcher/modplatform/import_ftb/PackInstallTask.cpp b/launcher/modplatform/import_ftb/PackInstallTask.cpp index 7a31d92a5..1b13964a2 100644 --- a/launcher/modplatform/import_ftb/PackInstallTask.cpp +++ b/launcher/modplatform/import_ftb/PackInstallTask.cpp @@ -50,10 +50,11 @@ void PackInstallTask::copySettings() { setStatus(tr("Copying settings...")); progress(2, 2); + QString instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg"); - auto instanceSettings = std::make_unique(instanceConfigPath); - instanceSettings->suspendSave(); - MinecraftInstance instance(m_globalSettings, std::move(instanceSettings), m_stagingPath); + MinecraftInstance instance(m_globalSettings, std::make_unique(instanceConfigPath), m_stagingPath); + SettingsObject::Lock lock(instance.settings()); + instance.settings()->set("InstanceType", "OneSix"); instance.settings()->set("totalTimePlayed", m_pack.totalPlayTime / 1000); @@ -108,7 +109,6 @@ void PackInstallTask::copySettings() if (m_instIcon == "default") m_instIcon = "ftb_logo"; instance.setIconKey(m_instIcon); - instance.settings()->resumeSave(); emitSucceeded(); } diff --git a/launcher/modplatform/legacy_ftb/PackInstallTask.cpp b/launcher/modplatform/legacy_ftb/PackInstallTask.cpp index ef1816557..51e4f4b9d 100644 --- a/launcher/modplatform/legacy_ftb/PackInstallTask.cpp +++ b/launcher/modplatform/legacy_ftb/PackInstallTask.cpp @@ -133,10 +133,9 @@ void PackInstallTask::install() } QString instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg"); - auto instanceSettings = std::make_unique(instanceConfigPath); - instanceSettings->suspendSave(); + MinecraftInstance instance(m_globalSettings, std::make_unique(instanceConfigPath), m_stagingPath); + SettingsObject::Lock lock(instance.settings()); - MinecraftInstance instance(m_globalSettings, std::move(instanceSettings), m_stagingPath); auto components = instance.getPackProfile(); components->buildingFromScratch(); components->setComponentVersion("net.minecraft", m_pack.mcVersion, true); @@ -204,7 +203,6 @@ void PackInstallTask::install() m_instIcon = "ftb_logo"; } instance.setIconKey(m_instIcon); - instance.settings()->resumeSave(); emitSucceeded(); }