Sorry for reverting a lot but copying a list just hurts me

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2022-11-03 17:33:21 +00:00
parent 5b9bfe8891
commit 404796d4b2
2 changed files with 10 additions and 12 deletions

View File

@ -82,7 +82,7 @@ public abstract class AbstractLauncher implements Launcher {
protected AbstractLauncher(Parameters params) protected AbstractLauncher(Parameters params)
{ {
this.mcParams = Collections.unmodifiableList(params.getList("param", new ArrayList<String>())); this.mcParams = params.getList("param", new ArrayList<String>());
this.mainClassName = params.getString("mainClass", "net.minecraft.client.Minecraft"); this.mainClassName = params.getString("mainClass", "net.minecraft.client.Minecraft");
this.serverAddress = params.getString("serverAddress", null); this.serverAddress = params.getString("serverAddress", null);

View File

@ -79,24 +79,22 @@ public final class StandardLauncher extends AbstractLauncher {
// the following often breaks linux screen setups // the following often breaks linux screen setups
// mcparams.add("--fullscreen"); // mcparams.add("--fullscreen");
List<String> launchParameters = new ArrayList<>(this.mcParams);
if (!this.maximize) { if (!this.maximize) {
launchParameters.add("--width"); mcParams.add("--width");
launchParameters.add(Integer.toString(width)); mcParams.add(Integer.toString(width));
launchParameters.add("--height"); mcParams.add("--height");
launchParameters.add(Integer.toString(height)); mcParams.add(Integer.toString(height));
} }
if (this.serverAddress != null) { if (this.serverAddress != null) {
launchParameters.add("--server"); mcParams.add("--server");
launchParameters.add(serverAddress); mcParams.add(serverAddress);
launchParameters.add("--port"); mcParams.add("--port");
launchParameters.add(serverPort); mcParams.add(serverPort);
} }
MethodHandle method = ReflectionUtils.findMainMethod(this.mainClassName); MethodHandle method = ReflectionUtils.findMainMethod(this.mainClassName);
method.invokeExact(launchParameters.toArray(new String[0])); method.invokeExact(mcParams.toArray(new String[0]));
} }
private static class StandardLauncherProvider implements LauncherProvider { private static class StandardLauncherProvider implements LauncherProvider {