Jump to content

[SOLVED] GUI not opening at all


Reflxction

Recommended Posts

Hello. I'm sorta new to Minecraft modding, but I'm experiencing a very annoying bug which I cannot seem to resolve. I have a GUI screen, and every time I try to open it, it doesn't open. This is killing me. I've made a GUI with 1.11 and higher and it worked completely fine, but with 1.8.9, it's not working at all. Here's my GUI class: https://www.hastebin.com/iziwiyorob.java

 

I have a command class, and everytime I try to open the GUI it doesn't open.

 

if (args.length == 1) {
    if (args[0].equalsIgnoreCase("gui")) {
        Minecraft.getMinecraft().displayGuiScreen(new MainGUI());
    }
}

This simply doesn't open. I did some debugging to see if it's fired and it is. It just doesn't open. I tried loads of things to make it open, like sending a message then listening for ClientChatReceivedEvent, and also created a custom event and fired it when this argument is entered but still doesn't open, but it just doesn't. Any help will be much appreciated. Thanks

Edited by Reflxction
Link to comment
Share on other sites

5 hours ago, diesieben07 said:
  • First, is this a client command? Registered with ClientCommandHandler? If not, you need to fix that first. You cannot open GUIs from the server.
  • You cannot open a GUI from a client-side command immediately, since the chat GUI will close after submitting the command, closing any GUI that is currently open. You must delay the opening by one tick.

Oh thanks mate, I really didn't think of it like this. I've delayed it by 1 tick and now it works perfectly, thanks man :D

 

I'm new to this forums thingy, how do I mark the thread as solved?

Edited by Reflxction
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.