Jump to content

Removing string/buttons from gui


weeeee

Recommended Posts

Hi, I wanted to remove a button and a string from an exisiting gui. "event.buttonList.remove(2);" worked perfectly fine to remove the button but is there a similar code to remove a string? :)

And also, is there a way to change the state of a button? For instance when I click on "Create World" it's usually set to "Survivial" and I would like it to be set to "Creative" without having to click on it :)

Link to comment
Share on other sites

1 hour ago, diesieben07 said:

No. Text drawing is usually hardcoded in the GUIs drawScreen method.

 

There is no uniform way. You need to check what the button does when clicked on and then perform a similar action when the GUI is opened.

Oh okay. And is there a way to "hide" buttons instead of removing them with "event.buttonList.remove(2);"? That one seems to crash my game :L

Link to comment
Share on other sites

If you can get the GuiButton variable

possibly event.buttonList.get(number) or something like that

You can set the visible variable to true/false

Link to comment
Share on other sites

Just now, weeeee said:

But where am I supposed to get that variable? :L

Quote

possibly event.buttonList.get(number) or something like that

 

 

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.

Announcements



×
×
  • Create New...

Important Information

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