summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-09 01:22:02 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-09 01:22:02 +0100
commitb6f133f579d77d4fa8d403448dd951563cda1a22 (patch)
treedef67e5b0522e66ba160bfc3477a67b83ac52be7 /api/logic/minecraft
parent01649f761d4839bd7a6f471f7f79acc02654676b (diff)
downloadMultiMC-b6f133f579d77d4fa8d403448dd951563cda1a22.tar
MultiMC-b6f133f579d77d4fa8d403448dd951563cda1a22.tar.gz
MultiMC-b6f133f579d77d4fa8d403448dd951563cda1a22.tar.lz
MultiMC-b6f133f579d77d4fa8d403448dd951563cda1a22.tar.xz
MultiMC-b6f133f579d77d4fa8d403448dd951563cda1a22.zip
GH-1713 fix FTB loading crashes
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r--api/logic/minecraft/ftb/FTBInstanceProvider.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/api/logic/minecraft/ftb/FTBInstanceProvider.cpp b/api/logic/minecraft/ftb/FTBInstanceProvider.cpp
index a583c039..1321ea1b 100644
--- a/api/logic/minecraft/ftb/FTBInstanceProvider.cpp
+++ b/api/logic/minecraft/ftb/FTBInstanceProvider.cpp
@@ -236,15 +236,6 @@ InstancePtr FTBInstanceProvider::createInstance(const FTBRecord & record) const
qDebug() << "Converting " << record.name << " as new.";
- auto mcVersion = std::dynamic_pointer_cast<MinecraftVersion>(ENV.getVersion("net.minecraft", record.mcVersion));
- if (!mcVersion)
- {
- qCritical() << "Can't load instance " << record.instanceDir
- << " because minecraft version " << record.mcVersion
- << " can't be resolved.";
- return nullptr;
- }
-
if (!rootDir.exists() && !rootDir.mkpath("."))
{
qCritical() << "Can't create instance folder" << record.instanceDir;
@@ -254,7 +245,9 @@ InstancePtr FTBInstanceProvider::createInstance(const FTBRecord & record) const
auto m_settings = std::make_shared<INISettingsObject>(FS::PathCombine(record.instanceDir, "instance.cfg"));
m_settings->registerSetting("InstanceType", "Legacy");
- if (mcVersion->usesLegacyLauncher())
+ // all legacy versions are built in. therefore we can do this even if we don't have ALL the versions Mojang has on their servers.
+ auto mcVersion = std::dynamic_pointer_cast<MinecraftVersion>(ENV.getVersion("net.minecraft", record.mcVersion));
+ if (mcVersion && mcVersion->usesLegacyLauncher())
{
m_settings->set("InstanceType", "LegacyFTB");
inst.reset(new LegacyFTBInstance(m_globalSettings, m_settings, record.instanceDir));
@@ -264,10 +257,11 @@ InstancePtr FTBInstanceProvider::createInstance(const FTBRecord & record) const
m_settings->set("InstanceType", "OneSixFTB");
inst.reset(new OneSixFTBInstance(m_globalSettings, m_settings, record.instanceDir));
}
+
// initialize
{
SettingsObject::Lock lock(inst->settings());
- inst->setIntendedVersionId(mcVersion->descriptor());
+ inst->setIntendedVersionId(record.mcVersion);
inst->init();
inst->setGroupInitial("FTB");
inst->setName(record.name);