Commit 219c060267a2350b0dbcba41efc04c6ae1541255
1 parent
8e841586
Passthrough GradleStart args when appropriate
Showing
1 changed file
with
15 additions
and
5 deletions
src/debug/java/com/mumfrey/liteloader/debug/Start.java
@@ -123,6 +123,7 @@ public abstract class Start | @@ -123,6 +123,7 @@ public abstract class Start | ||
123 | 123 | ||
124 | File gameDir = new File(System.getProperty("user.dir")); | 124 | File gameDir = new File(System.getProperty("user.dir")); |
125 | File assetsDir = new File(gameDir, "assets"); | 125 | File assetsDir = new File(gameDir, "assets"); |
126 | + File assetIndexDir = new File(assetsDir, "indexes"); | ||
126 | 127 | ||
127 | Start.addArg(qualifiedArgs, "--tweakClass", LiteLoaderTweaker.class.getName()); | 128 | Start.addArg(qualifiedArgs, "--tweakClass", LiteLoaderTweaker.class.getName()); |
128 | Start.addArg(qualifiedArgs, "--username", loginManager.getProfileName()); | 129 | Start.addArg(qualifiedArgs, "--username", loginManager.getProfileName()); |
@@ -130,10 +131,10 @@ public abstract class Start | @@ -130,10 +131,10 @@ public abstract class Start | ||
130 | Start.addArg(qualifiedArgs, "--accessToken", loginManager.getAuthenticatedToken()); | 131 | Start.addArg(qualifiedArgs, "--accessToken", loginManager.getAuthenticatedToken()); |
131 | Start.addArg(qualifiedArgs, "--userType", loginManager.getUserType()); | 132 | Start.addArg(qualifiedArgs, "--userType", loginManager.getUserType()); |
132 | Start.addArg(qualifiedArgs, "--userProperties", loginManager.getUserProperties()); | 133 | Start.addArg(qualifiedArgs, "--userProperties", loginManager.getUserProperties()); |
133 | - Start.addArg(qualifiedArgs, "--version", "mcp"); | ||
134 | - Start.addArg(qualifiedArgs, "--gameDir", gameDir.getAbsolutePath()); | ||
135 | - Start.addArg(qualifiedArgs, "--assetIndex", LiteLoaderTweaker.VERSION); | ||
136 | - Start.addArg(qualifiedArgs, "--assetsDir", assetsDir.getAbsolutePath()); | 134 | + Start.addArg(qualifiedArgs, "--version", "mcp", true); |
135 | + Start.addArg(qualifiedArgs, "--gameDir", gameDir.getAbsolutePath(), true); | ||
136 | + Start.addArg(qualifiedArgs, "--assetIndex", LiteLoaderTweaker.VERSION, true); | ||
137 | + Start.addArg(qualifiedArgs, "--assetsDir", assetsDir.getAbsolutePath(), !assetIndexDir.exists()); | ||
137 | } | 138 | } |
138 | 139 | ||
139 | private static void addRequiredArgsServer(String[] args, List<String> unqualifiedArgs, Map<String, Set<String>> qualifiedArgs) | 140 | private static void addRequiredArgsServer(String[] args, List<String> unqualifiedArgs, Map<String, Set<String>> qualifiedArgs) |
@@ -162,13 +163,22 @@ public abstract class Start | @@ -162,13 +163,22 @@ public abstract class Start | ||
162 | 163 | ||
163 | private static void addArg(Map<String, Set<String>> qualifiedArgs, String qualifier, String arg) | 164 | private static void addArg(Map<String, Set<String>> qualifiedArgs, String qualifier, String arg) |
164 | { | 165 | { |
166 | + Start.addArg(qualifiedArgs, qualifier, arg, false); | ||
167 | + } | ||
168 | + | ||
169 | + private static void addArg(Map<String, Set<String>> qualifiedArgs, String qualifier, String arg, boolean skipExisting) | ||
170 | + { | ||
165 | Set<String> args = qualifiedArgs.get(qualifier); | 171 | Set<String> args = qualifiedArgs.get(qualifier); |
166 | - | 172 | + |
167 | if (args == null) | 173 | if (args == null) |
168 | { | 174 | { |
169 | args = new HashSet<String>(); | 175 | args = new HashSet<String>(); |
170 | qualifiedArgs.put(qualifier, args); | 176 | qualifiedArgs.put(qualifier, args); |
171 | } | 177 | } |
178 | + else if (skipExisting) | ||
179 | + { | ||
180 | + return; | ||
181 | + } | ||
172 | 182 | ||
173 | if (!Start.MULTI_VALUE_ARGS.contains(qualifier)) | 183 | if (!Start.MULTI_VALUE_ARGS.contains(qualifier)) |
174 | { | 184 | { |