Posted November 9, 201212 yr 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
November 9, 201212 yr 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.
November 9, 201212 yr Author 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)?
November 10, 201212 yr Go on Github, fork forge, make you're changes, pull request and wait for mainteiners to approve. Anyway, onTickInGui is fine.
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.