NOISSUE Make LauncherPart aware of server to join

This commit is contained in:
Janrupf
2021-05-22 16:32:15 +02:00
parent 23a706bbae
commit 0ccd7223fd
3 changed files with 42 additions and 3 deletions

View File

@ -47,6 +47,9 @@ public class OneSixLauncher implements Launcher
private boolean maximize;
private String cwd;
private String serverAddress;
private String serverPort;
// the much abused system classloader, for convenience (for further abuse)
private ClassLoader cl;
@ -64,6 +67,9 @@ public class OneSixLauncher implements Launcher
windowTitle = params.firstSafe("windowTitle", "Minecraft");
windowParams = params.firstSafe("windowParams", "854x480");
serverAddress = params.firstSafe("serverAddress", null);
serverPort = params.firstSafe("serverPort", null);
cwd = System.getProperty("user.dir");
winSizeW = 854;
@ -122,7 +128,7 @@ public class OneSixLauncher implements Launcher
Class<?> MCAppletClass = cl.loadClass(appletClass);
Applet mcappl = (Applet) MCAppletClass.newInstance();
LegacyFrame mcWindow = new LegacyFrame(windowTitle);
mcWindow.start(mcappl, userName, sessionId, winSizeW, winSizeH, maximize);
mcWindow.start(mcappl, userName, sessionId, winSizeW, winSizeH, maximize, serverAddress, serverPort);
return 0;
} catch (Exception e)
{
@ -164,6 +170,14 @@ public class OneSixLauncher implements Launcher
mcparams.add(Integer.toString(winSizeH));
}
if (serverAddress != null)
{
mcparams.add("--server");
mcparams.add(serverAddress);
mcparams.add("--port");
mcparams.add(serverPort);
}
// Get the Minecraft Class.
Class<?> mc;
try