2016-10-02 23:55:54 +01:00
|
|
|
#include "InstanceCreationTask.h"
|
|
|
|
#include "BaseInstanceProvider.h"
|
|
|
|
#include "settings/INISettingsObject.h"
|
|
|
|
#include "FileSystem.h"
|
|
|
|
|
|
|
|
//FIXME: remove this
|
2017-07-24 08:01:37 +01:00
|
|
|
#include "minecraft/MinecraftInstance.h"
|
2017-11-11 00:38:31 +00:00
|
|
|
#include "minecraft/ComponentList.h"
|
2016-10-02 23:55:54 +01:00
|
|
|
|
2018-03-19 01:36:12 +00:00
|
|
|
InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version)
|
2016-10-02 23:55:54 +01:00
|
|
|
{
|
|
|
|
m_version = version;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InstanceCreationTask::executeTask()
|
|
|
|
{
|
2017-05-03 22:11:52 +01:00
|
|
|
setStatus(tr("Creating instance from version %1").arg(m_version->name()));
|
2017-09-05 22:38:17 +01:00
|
|
|
{
|
|
|
|
auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(m_stagingPath, "instance.cfg"));
|
|
|
|
instanceSettings->suspendSave();
|
|
|
|
instanceSettings->registerSetting("InstanceType", "Legacy");
|
|
|
|
instanceSettings->set("InstanceType", "OneSix");
|
2017-11-11 00:38:31 +00:00
|
|
|
MinecraftInstance inst(m_globalSettings, instanceSettings, m_stagingPath);
|
|
|
|
auto components = inst.getComponentList();
|
|
|
|
components->buildingFromScratch();
|
|
|
|
components->setComponentVersion("net.minecraft", m_version->descriptor(), true);
|
|
|
|
inst.setName(m_instName);
|
|
|
|
inst.setIconKey(m_instIcon);
|
|
|
|
inst.init();
|
2017-09-05 22:38:17 +01:00
|
|
|
instanceSettings->resumeSave();
|
|
|
|
}
|
2016-10-02 23:55:54 +01:00
|
|
|
emitSucceeded();
|
|
|
|
}
|