Jump to content

Recommended Posts

Posted

Hello,

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?

 

Thanks,

jrtc27

Posted

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.

Posted

Thanks for that. It all looks a bit horrible and hacky though... What license is Forge released under (i.e. can I decompile the relevant class and create my own modded version of the GuiMainMenu class which includes Forge)?

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.