MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / plusJarModFromJson

Method plusJarModFromJson

launcher/minecraft/OneSixVersionFormat.cpp:362–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362LibraryPtr OneSixVersionFormat::plusJarModFromJson([[maybe_unused]] ProblemContainer& problems,
363 const QJsonObject& libObj,
364 const QString& filename,
365 const QString& originalName)
366{
367 LibraryPtr out(new Library());
368 if (!libObj.contains("name")) {
369 throw JSONValidationError(filename + "contains a jarmod that doesn't have a 'name' field");
370 }
371
372 // just make up something unique on the spot for the library name.
373 auto uuid = QUuid::createUuid();
374 QString id = uuid.toString().remove('{').remove('}');
375 out->setRawName(GradleSpecifier("org.multimc.jarmods:" + id + ":1"));
376
377 // filename override is the old name
378 out->setFilename(libObj.value("name").toString());
379
380 // it needs to be local, it is stored in the instance jarmods folder
381 out->setHint("local");
382
383 // read the original name if present - some versions did not set it
384 // it is the original jar mod filename before it got renamed at the point of addition
385 auto displayName = libObj.value("originalName").toString();
386 if (displayName.isEmpty()) {
387 auto fixed = originalName;
388 fixed.remove(" (jar mod)");
389 out->setDisplayName(fixed);
390 } else {
391 out->setDisplayName(displayName);
392 }
393 return out;
394}
395
396LibraryPtr OneSixVersionFormat::jarModFromJson(ProblemContainer& problems, const QJsonObject& libObj, const QString& filename)
397{

Callers

nothing calls this directly

Calls 10

GradleSpecifierClass · 0.85
setRawNameMethod · 0.80
setFilenameMethod · 0.80
valueMethod · 0.80
setHintMethod · 0.80
setDisplayNameMethod · 0.80
containsMethod · 0.45
removeMethod · 0.45
toStringMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected