mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 00:29:50 -04:00
[Custom version] Improve MC version inheriting combination
This commit is contained in:
parent
bfec5cdd44
commit
a33dcfaf9f
@ -41,6 +41,9 @@ public class JMinecraftVersionList {
|
|||||||
public ArgRules[] rules;
|
public ArgRules[] rules;
|
||||||
public String value;
|
public String value;
|
||||||
|
|
||||||
|
// TLauncher styled argument...
|
||||||
|
public String[] values;
|
||||||
|
|
||||||
public static class ArgRules {
|
public static class ArgRules {
|
||||||
public String action;
|
public String action;
|
||||||
public String features;
|
public String features;
|
||||||
|
@ -185,6 +185,10 @@ public final class Tools
|
|||||||
for (Object arg : versionInfo.arguments.game) {
|
for (Object arg : versionInfo.arguments.game) {
|
||||||
if (arg instanceof String) {
|
if (arg instanceof String) {
|
||||||
minecraftArgs.add((String) arg);
|
minecraftArgs.add((String) arg);
|
||||||
|
} else {
|
||||||
|
JMinecraftVersionList.Arguments.ArgValue argv = (JMinecraftVersionList.Arguments.ArgValue) arg;
|
||||||
|
if (argv.values != null) {
|
||||||
|
minecraftArgs.add(argv.values[0]);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
for (JMinecraftVersionList.Arguments.ArgValue.ArgRules rule : arg.rules) {
|
for (JMinecraftVersionList.Arguments.ArgValue.ArgRules rule : arg.rules) {
|
||||||
@ -195,6 +199,7 @@ public final class Tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String[] argsFromJson = insertVariableArgument(
|
String[] argsFromJson = insertVariableArgument(
|
||||||
splitAndFilterEmpty(
|
splitAndFilterEmpty(
|
||||||
@ -573,7 +578,7 @@ public final class Tools
|
|||||||
|
|
||||||
insertSafety(inheritsVer, customVer,
|
insertSafety(inheritsVer, customVer,
|
||||||
"assetIndex", "assets",
|
"assetIndex", "assets",
|
||||||
"id", "mainClass", "minecraftArguments",
|
"mainClass", "minecraftArguments",
|
||||||
"optifineLib", "releaseTime", "time", "type"
|
"optifineLib", "releaseTime", "time", "type"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -589,9 +594,36 @@ public final class Tools
|
|||||||
// Inheriting Minecraft 1.13+ with append custom args
|
// Inheriting Minecraft 1.13+ with append custom args
|
||||||
if (inheritsVer.arguments != null && customVer.arguments != null) {
|
if (inheritsVer.arguments != null && customVer.arguments != null) {
|
||||||
List totalArgList = new ArrayList();
|
List totalArgList = new ArrayList();
|
||||||
totalArgList.addAll(Arrays.asList(customVer.arguments.game));
|
|
||||||
totalArgList.addAll(Arrays.asList(inheritsVer.arguments.game));
|
totalArgList.addAll(Arrays.asList(inheritsVer.arguments.game));
|
||||||
|
|
||||||
|
int nskip = 0;
|
||||||
|
for (int i = 0; i < customVer.arguments.game.length; i++) {
|
||||||
|
if (nskip > 0) {
|
||||||
|
nskip--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object perCustomArg = customVer.arguments.game[i];
|
||||||
|
if (perCustomArg instanceof String) {
|
||||||
|
String perCustomArgStr = (String) perCustomArg;
|
||||||
|
// Check if there is a duplicate argument on combine
|
||||||
|
if (perCustomArgStr.startsWith("--") && totalArgList.contains(perCustomArgStr)) {
|
||||||
|
perCustomArg = customVer.arguments.game[i + 1];
|
||||||
|
if (perCustomArg instanceof String) {
|
||||||
|
perCustomArgStr = (String) perCustomArg;
|
||||||
|
// If the next is argument value, skip it
|
||||||
|
if (!perCustomArgStr.startsWith("--")) {
|
||||||
|
nskip++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
totalArgList.add(perCustomArgStr);
|
||||||
|
}
|
||||||
|
} else if (!totalArgList.contains(perCustomArg)) {
|
||||||
|
totalArgList.add(perCustomArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inheritsVer.arguments.game = totalArgList.toArray(new Object[0]);
|
inheritsVer.arguments.game = totalArgList.toArray(new Object[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user