MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / createLaunchScript

Method createLaunchScript

launcher/minecraft/MinecraftInstance.cpp:585–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583}
584
585QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin)
586{
587 QString launchScript;
588
589 if (!m_components)
590 return QString();
591 auto profile = m_components->getProfile();
592 if(!profile)
593 return QString();
594
595 auto mainClass = getMainClass();
596 if (!mainClass.isEmpty())
597 {
598 launchScript += "mainClass " + mainClass + "\n";
599 }
600 auto appletClass = profile->getAppletClass();
601 if (!appletClass.isEmpty())
602 {
603 launchScript += "appletClass " + appletClass + "\n";
604 }
605
606 if (serverToJoin && !serverToJoin->address.isEmpty())
607 {
608 launchScript += "serverAddress " + serverToJoin->address + "\n";
609 launchScript += "serverPort " + QString::number(serverToJoin->port) + "\n";
610 }
611
612 // generic minecraft params
613 for (auto param : processMinecraftArgs(
614 session,
615 nullptr /* When using a launch script, the server parameters are handled by it*/
616 ))
617 {
618 launchScript += "param " + param + "\n";
619 }
620
621 // window size, title and state, legacy
622 {
623 QString windowParams;
624 if (settings()->get("LaunchMaximized").toBool())
625 windowParams = "max";
626 else
627 windowParams = QString("%1x%2")
628 .arg(settings()->get("MinecraftWinWidth").toInt())
629 .arg(settings()->get("MinecraftWinHeight").toInt());
630 launchScript += "windowTitle " + windowTitle() + "\n";
631 launchScript += "windowParams " + windowParams + "\n";
632 }
633
634 // legacy auth
635 if(session)
636 {
637 launchScript += "userName " + session->player_name + "\n";
638 launchScript += "sessionId " + session->session + "\n";
639 }
640
641 // libraries and class path.
642 {

Callers 1

executeTaskMethod · 0.80

Calls 6

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

Tested by

no test coverage detected