Use GuiEnvBackend when launching dist with GuiCommand

This commit is contained in:
Johannes Frohnmeyer 2022-09-07 18:55:15 +02:00
parent 5cc2b416be
commit cdf81fcb57
Signed by: Johannes
GPG Key ID: E76429612C2929F4
2 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,9 @@ package io.gitlab.jfronny.inceptum;
import io.gitlab.jfronny.inceptum.cli.Command;
import io.gitlab.jfronny.inceptum.cli.CommandArgs;
import io.gitlab.jfronny.inceptum.imgui.GuiEnvBackend;
import io.gitlab.jfronny.inceptum.imgui.GuiMain;
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv;
public class GuiCommand extends Command {
public GuiCommand() {
@ -11,6 +13,7 @@ public class GuiCommand extends Command {
@Override
public void invoke(CommandArgs args) {
LauncherEnv.updateBackend(new GuiEnvBackend());
GuiMain.main();
}

View File

@ -14,6 +14,7 @@ import io.gitlab.jfronny.inceptum.launcher.system.source.ModSource;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Objects;
import java.util.function.Consumer;
public class LauncherEnv {
@ -24,7 +25,7 @@ public class LauncherEnv {
throw new IllegalStateException("Mismatching classloader between two classes. Something is wrong here");
}
LauncherEnv.backend = backend;
updateBackend(backend);
GsonHolder.registerTypeAdapter(MinecraftArgument.class, new MinecraftArgumentDeserializer());
GsonHolder.registerTypeAdapter(Rules.class, new RulesDeserializer());
@ -57,6 +58,10 @@ public class LauncherEnv {
}
}
public static void updateBackend(EnvBackend backend) {
LauncherEnv.backend = Objects.requireNonNull(backend);
}
public static void terminate() {
ModsDirScanner.closeAll();
}