Jump to content

How To Add To Main Menu


Recommended Posts


With my mod, I'm trying to add a button to the main menu in order to take the user to a different GUI. I have it working for when I mod GuiMainMenu itself, but of course this is not compatible with Forge. I was wondering if there is a way to add this button whilst still maintaining Forge compatibility?




Link to comment
Share on other sites

You'd have to make:


protected List controlList = new ArrayList();


Not protected but public via Access Transformers. Then you can add everything you want to the controlList.


But you can't add custom function to that.


However you can do something.


Make this public too:


private GuiButton selectedButton = null;


Start some sort of loop (I don't know what you can do. Maybe a thread?) and check the value of selectedButton. If it's different from null and the id of the button is what you're looking for then run that function. GuiMainMenu's actionPerformed will just don't care about the id of you're button and you can do whatever you want.


Again, I'm not sure on how you can make that loop. TickInGui? Just look in JavaDocs or wait for someone to give a better answer.

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.

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.