Posted September 6, 20178 yr Just for context on how experience I am with this, I started Minecraft modding about a month ago, although have experience in other languages (and a tiny bit of Java) before now. I'm making a client-side mod, and for the life of me I can't figure out how to open a custom GUI via command. I have the following code that works just fine: @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { // If open GUI key is pressed on Hypixel if(QuickPlay.openGui.isKeyDown() && QuickPlay.onHypixel) { System.out.println("Open GUI key pressed"); Minecraft.getMinecraft().displayGuiScreen(new GuiScreen(){}); } } A new, blank GUI is opened when the bound key is pressed and you're on the proper server. Works fine. I now have a separate GUI I was hoping to open from a command ("/qpcolor"). QpColorCommand.java#execute (Implements ICommand): @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { Minecraft.getMinecraft().displayGuiScreen(new GuiScreen(){}); } QpColorCommand is registered in QuickPlay#postInit: @EventHandler public void postInit(FMLPostInitializationEvent event) { ClientCommandHandler.instance.registerCommand(new QpColorCommand()); } But, with all of this, /qpcolor does not open the GUI. Everything else in QpColorCommand#execute runs fine! I've Google'd around with no luck. I feel like I'm missing something obvious here, but I'm not sure what. Any advice? Thanks! EDIT: I just checked the source of another mod that opens a GUI via command. It looks like they added a 2-tick delay before opening the GUI. Is this why it is not working for me? Is there a better way around this? Any advice is appreciated. Edited September 6, 20178 yr by bugfroggy Added info that I went and checked source
September 6, 20178 yr Author 12 minutes ago, diesieben07 said: Yes, after the command executes, the chat GUI tells minecraft to close any open GUI, assuming the chat gui itself is still open. If you opened another GUI in between, it gets closed instead. You have to open the GUI a tick later. That makes sense! I'll try that. Thank you
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.