MCPcopy Create free account
hub / github.com/MultiMC/Launcher / createLaunchScript

Method createLaunchScript

launcher/minecraft/MinecraftInstance.cpp:468–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin)
469{
470 QString launchScript;
471
472 if (!m_components)
473 return QString();
474 auto profile = m_components->getProfile();
475 if(!profile)
476 return QString();
477
478 auto mainClass = getMainClass();
479 if (!mainClass.isEmpty())
480 {
481 launchScript += "mainClass " + mainClass + "\n";
482 }
483 auto appletClass = profile->getAppletClass();
484 if (!appletClass.isEmpty())
485 {
486 launchScript += "appletClass " + appletClass + "\n";
487 }
488
489 if (serverToJoin && !serverToJoin->address.isEmpty())
490 {
491 launchScript += "serverAddress " + serverToJoin->address + "\n";
492 launchScript += "serverPort " + QString::number(serverToJoin->port) + "\n";
493 }
494
495 // generic minecraft params
496 for (auto param : processMinecraftArgs(
497 session,
498 nullptr /* When using a launch script, the server parameters are handled by it*/
499 ))
500 {
501 launchScript += "param " + param + "\n";
502 }
503
504 // window size, title and state, legacy
505 {
506 QString windowParams;
507 if (settings()->get("LaunchMaximized").toBool())
508 windowParams = "max";
509 else
510 windowParams = QString("%1x%2")
511 .arg(settings()->get("MinecraftWinWidth").toInt())
512 .arg(settings()->get("MinecraftWinHeight").toInt());
513 launchScript += "windowTitle " + windowTitle() + "\n";
514 launchScript += "windowParams " + windowParams + "\n";
515 }
516
517 // legacy auth
518 if(session)
519 {
520 launchScript += "userName " + session->player_name + "\n";
521 launchScript += "sessionId " + session->session + "\n";
522 }
523
524 // libraries and class path.
525 {

Callers 1

executeTaskMethod · 0.80

Calls 7

QStringClass · 0.85
getProfileMethod · 0.80
isEmptyMethod · 0.80
getAppletClassMethod · 0.80
getLibraryFilesMethod · 0.80
getMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected