From e22e70ea81cd9dae5aebb17facaae82dab2be9df Mon Sep 17 00:00:00 2001 From: Henry Le Grys Date: Wed, 23 Dec 2020 00:23:35 +0000 Subject: [PATCH] Add flag in version info: loader should override version arguments Fixes #4 --- .../launcher/builder/loaders/ModernForgeLoaderProcessor.java | 4 ++++ .../java/com/skcraft/launcher/model/loader/VersionInfo.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java b/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java index 3149b59..0814bee 100644 --- a/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java +++ b/launcher-builder/src/main/java/com/skcraft/launcher/builder/loaders/ModernForgeLoaderProcessor.java @@ -54,6 +54,10 @@ public class ModernForgeLoaderProcessor implements ILoaderProcessor { // Copy game arguments List gameArguments = info.getArguments().getGameArguments(); if (gameArguments != null) { + if (info.isOverridingArguments()) { + version.getArguments().getGameArguments().clear(); + } + version.getArguments().getGameArguments().addAll(gameArguments); } diff --git a/launcher/src/main/java/com/skcraft/launcher/model/loader/VersionInfo.java b/launcher/src/main/java/com/skcraft/launcher/model/loader/VersionInfo.java index 55908d5..7d383bc 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/loader/VersionInfo.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/loader/VersionInfo.java @@ -6,6 +6,7 @@ package com.skcraft.launcher.model.loader; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.google.common.base.Splitter; import com.skcraft.launcher.model.minecraft.GameArgument; @@ -24,6 +25,8 @@ public class VersionInfo { private String mainClass; private List libraries; + @JsonIgnore private transient boolean overridingArguments; + public void setMinecraftArguments(String argumentString) { MinecraftArguments minecraftArguments = new MinecraftArguments(); minecraftArguments.setGameArguments(new ArrayList()); @@ -33,5 +36,6 @@ public class VersionInfo { } setArguments(minecraftArguments); + setOverridingArguments(true); } }