2016-10-03 04:25:54 +05:30
|
|
|
#include "InstanceCreationTask.h"
|
|
|
|
#include "settings/INISettingsObject.h"
|
|
|
|
#include "FileSystem.h"
|
|
|
|
|
|
|
|
//FIXME: remove this
|
2017-07-24 12:31:37 +05:30
|
|
|
#include "minecraft/MinecraftInstance.h"
|
2020-06-27 15:32:31 +05:30
|
|
|
#include "minecraft/PackProfile.h"
|
2016-10-03 04:25:54 +05:30
|
|
|
|
2018-03-19 07:06:12 +05:30
|
|
|
InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version)
|
2016-10-03 04:25:54 +05:30
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
m_version = version;
|
2016-10-03 04:25:54 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void InstanceCreationTask::executeTask()
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
setStatus(tr("Creating instance from version %1").arg(m_version->name()));
|
|
|
|
{
|
|
|
|
auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(m_stagingPath, "instance.cfg"));
|
|
|
|
instanceSettings->suspendSave();
|
|
|
|
MinecraftInstance inst(m_globalSettings, instanceSettings, m_stagingPath);
|
2020-06-27 15:32:31 +05:30
|
|
|
auto components = inst.getPackProfile();
|
2018-07-15 18:21:05 +05:30
|
|
|
components->buildingFromScratch();
|
|
|
|
components->setComponentVersion("net.minecraft", m_version->descriptor(), true);
|
|
|
|
inst.setName(m_instName);
|
|
|
|
inst.setIconKey(m_instIcon);
|
|
|
|
instanceSettings->resumeSave();
|
|
|
|
}
|
|
|
|
emitSucceeded();
|
2016-10-03 04:25:54 +05:30
|
|
|
}
|