| 202 | } |
| 203 | |
| 204 | void InstanceImportTask::processFlame() |
| 205 | { |
| 206 | const static QMap<QString,QString> forgemap = { |
| 207 | {"1.2.5", "3.4.9.171"}, |
| 208 | {"1.4.2", "6.0.1.355"}, |
| 209 | {"1.4.7", "6.6.2.534"}, |
| 210 | {"1.5.2", "7.8.1.737"} |
| 211 | }; |
| 212 | Flame::Manifest pack; |
| 213 | try |
| 214 | { |
| 215 | QString configPath = FS::PathCombine(m_stagingPath, "manifest.json"); |
| 216 | Flame::loadManifest(pack, configPath); |
| 217 | QFile::remove(configPath); |
| 218 | } |
| 219 | catch (const JSONValidationError &e) |
| 220 | { |
| 221 | emitFailed(tr("Could not understand pack manifest:\n") + e.cause()); |
| 222 | return; |
| 223 | } |
| 224 | if(!pack.overrides.isEmpty()) |
| 225 | { |
| 226 | QString overridePath = FS::PathCombine(m_stagingPath, pack.overrides); |
| 227 | if (QFile::exists(overridePath)) |
| 228 | { |
| 229 | QString mcPath = FS::PathCombine(m_stagingPath, "minecraft"); |
| 230 | if (!QFile::rename(overridePath, mcPath)) |
| 231 | { |
| 232 | emitFailed(tr("Could not rename the overrides folder:\n") + pack.overrides); |
| 233 | return; |
| 234 | } |
| 235 | } |
| 236 | else |
| 237 | { |
| 238 | logWarning(tr("The specified overrides folder (%1) is missing. Maybe the modpack was already used before?").arg(pack.overrides)); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | QString forgeVersion; |
| 243 | QString fabricVersion; |
| 244 | for(auto &loader: pack.minecraft.modLoaders) |
| 245 | { |
| 246 | auto id = loader.id; |
| 247 | if(id.startsWith("forge-")) |
| 248 | { |
| 249 | id.remove("forge-"); |
| 250 | forgeVersion = id; |
| 251 | continue; |
| 252 | } |
| 253 | if(id.startsWith("fabric-")) |
| 254 | { |
| 255 | id.remove("fabric-"); |
| 256 | fabricVersion = id; |
| 257 | continue; |
| 258 | } |
| 259 | logWarning(tr("Unknown mod loader in manifest: %1").arg(id)); |
| 260 | } |
| 261 |
nothing calls this directly
no test coverage detected