package io.gitlab.jfronny.inceptum.frontend.gui.window; import imgui.ImGui; import io.gitlab.jfronny.inceptum.frontend.gui.control.InstanceManageControls; import io.gitlab.jfronny.inceptum.util.Utils; import io.gitlab.jfronny.inceptum.util.install.SetupStepInfo; import io.gitlab.jfronny.inceptum.util.install.Steps; import java.io.IOException; public class NewInstanceWindow extends Window { private final InstanceManageControls imc = new InstanceManageControls(null, null); public NewInstanceWindow() { super("New Instance"); } @Override public void draw() { if (ImGui.beginTabBar("NewInstanceBar")) { if (ImGui.beginTabItem("New")) { imc.snapshotsBox(); imc.versionBox(ver -> {}); imc.nameBox("OK", name -> { try { GuiUtil.createInstance(new SetupStepInfo(imc.getVersionInfo(), imc.getLoaderInfo(), name, Steps.createProcessState())); } catch (IOException e) { Utils.LOGGER.error("Could not initialize instance creation", e); } close(); }); ImGui.endTabItem(); } if (ImGui.beginTabItem("Import")) { ImGui.text("You can also just add an instance directory and it'll be loaded automatically"); ImGui.text("Using git to manage it is recommended if you do so"); ImGui.spacing(); ImGui.text("Importing CurseForge or Modrinth packs is not yet implemented"); //TODO generic importer based on zip contents and file name ("mrpack") ImGui.endTabItem(); } ImGui.endTabBar(); } } }