add more options to ClientBoot
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m18s
/ Build BaseBand Loader (push) Successful in 1m42s

This commit is contained in:
Daniella / Tove 2024-06-25 10:41:11 +02:00
parent 123748211f
commit 54533140d2
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
3 changed files with 49 additions and 9 deletions

View file

@ -2,6 +2,7 @@ package de.com.baseband.client.feature.commands;
import de.com.baseband.client.feature.Feature;
import de.com.baseband.client.feature.category.Command;
import de.com.baseband.prod.LoadHandler;
import net.minecraft.client.multiplayer.GuiConnecting;
import static de.com.baseband.client.BaseBand.LOGGER;
@ -13,6 +14,13 @@ public class Connect extends Feature {
return "Connect";
}
@Override
protected void setup() {
if(LoadHandler.data.getString("autoJoin") != null) {
onCommand(LoadHandler.data.getString("autoJoin").split(":"));
}
}
@Override
public void onCommand(String[] args) {
if((args.length == 1 || args.length == 2) && notIngame()) {

View file

@ -5,6 +5,7 @@ import de.com.baseband.launcher.classloader.CustomClassLoader;
import de.com.baseband.launcher.security.SecurityImpl;
import de.com.baseband.launcher.security.impl.AntiInstrumentationImpl;
import de.com.baseband.launcher.security.impl.JVMArgImpl;
import de.com.baseband.launcher.util.ClientBootUtil;
import de.com.baseband.launcher.util.GitHash;
import de.com.baseband.launcher.util.RSAKey;
import de.com.baseband.launcher.util.Util;
@ -80,6 +81,7 @@ public class Loader implements Util {
preOptions.setIfAbsent("timeout", 5);
TCN options = new ClientBoot("BaseBand", preOptions.getInteger("timeout") * 1000, preOptions)
.label("Start Minecraft:")
.option("Run BaseBand now", ClientBoot::finish)
.option("Run without BaseBand", x -> {
x.data.set("loadBaseBand", false);
@ -102,17 +104,21 @@ public class Loader implements Util {
x.focus();
}
})
.option("Configure", x -> {
.spacer()
.label("Configuration:")
.option("Configure BaseBand", x -> {
x.data.setIfAbsent("disabledModules", new TCNArray());
x.newScreen()
.option(x.data.getArray("disabledModules").contains("AltControl") ? "Enable AltControl support" : "Disable AltControl support", x1 -> {
if(x.data.getArray("disabledModules").contains("AltControl")) {
x1.currentOption().name = "AltControl enabled.";
x1.data.getArray("disabledModules").remove("AltControl");
} else {
x1.currentOption().name = "AltControl disabled.";
x1.data.getArray("disabledModules").add("AltControl");
}
.option(ClientBootUtil.moduleToggleLabel(x, "Spotify"), ClientBootUtil.moduleToggle("Spotify"))
.option(ClientBootUtil.moduleToggleLabel(x, "Baritone"), ClientBootUtil.moduleToggle("Baritone"))
.option(ClientBootUtil.moduleToggleLabel(x, "AltControl"), ClientBootUtil.moduleToggle("AltControl"))
.option(ClientBootUtil.moduleToggleLabel(x, "TPAccept"), ClientBootUtil.moduleToggle("TPAccept"))
.option("Automatically join a server", x1 -> {
String ip = JOptionPane.showInputDialog("Please input the desired server IP:");
if(ip != null && ip.isEmpty())
ip = null;
x1.data.set("autoJoin", ip);
x1.focus();
})
.option("Change config file", x1 -> {
String file = JOptionPane.showInputDialog("Please input the desired name:");
@ -135,6 +141,7 @@ public class Loader implements Util {
throw new RuntimeException(e);
}
})
.spacer()
.option("Exit Minecraft", x -> exit())
.show();
options.setIfAbsent("ip", "baseband.com.de");

View file

@ -0,0 +1,25 @@
package de.com.baseband.launcher.util;
import de.com.baseband.clientboot.CBCallback;
import de.com.baseband.clientboot.ClientBoot;
import de.tudbut.parsing.TCNArray;
public class ClientBootUtil {
public static CBCallback moduleToggle(String module) {
return x -> {
TCNArray disabledModules = x.data.getArray("disabledModules");
if(disabledModules.contains(module)) {
x.currentOption().name = module + " enabled.";
disabledModules.remove(module);
} else {
x.currentOption().name = module + " disabled.";
disabledModules.add(module);
}
};
}
public static String moduleToggleLabel(ClientBoot cb, String name) {
return cb.data.getArray("disabledModules").contains(name) ? "Enable " + name + " support" : "Disable " + name + " support";
}
}