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

Method createLaunchScript

launcher/minecraft/MinecraftInstance.cpp:469–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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