Posted November 22, 201311 yr Hey, there are mods, in which there are tabs, attached to custom guis, such as TE http://technicpack.wikia.com/wiki/Thermal_Expansion_GUI How are these tabs done?
November 22, 201311 yr I haven't looked into this, but my best advice is to look at how minecraft does it with the creative menu and do your best to do that.
November 22, 201311 yr I'm using many of these in GUI's of my mod (PneumaticCraft) as well. It isn't something Vanilla/Forge you can hook into. It's coded from ground up. I've written a class that has lots of behaviours in it. When the player clicks on the tab, it toggles between opening/closing. Every update tick it increases it's height and width until they have reached their maximum. If they've reached that, they are allowed to render the text stored in the instance of this class. The value of width and height directly affect how big the tab is drawn. In the tab, it looks if it has a parent tab (a tab which when it expands should push this tab away). If so, it takes this parent tab height in account. This is just to give you an idea how I've done it. If you come to the conclusion you don't want to put that much time in it or if you think you'll not be able to do it I can announce that in PneumaticCraft's API (coming out in ~1 week) there is a way to retrieve you're own tabs (for your own GUI's). Problem is then that you'll be a dependent on PneumaticCraft. As being dependant upon a mod isn't the best, I suggest implementing you're own version of tabs using the expanation I've just given. Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.
November 22, 201311 yr I'd add buttons that renders like that, their position being set relative to the current gui size. Each one links to a different gui, while all gui contains all buttons, with the button linking to the current gui is disabled.
November 22, 201311 yr I do something similar in my FlenixCities mod in an incredibly simple way. If all you're doing is changing something you can alter within the GUI class on-screen (IE, you're not showing different items or anything like that), you can use a String as a variable to set a "GUI Stage". Then, when you click one of the tab buttons, it changes the string's value to a different number. You then use if statements to define what should be shown depending on which number the string is set to. May not be the neatest way but if you're only doing simple stuff, it's certainly the easiest. http://s13.postimg.org/z9mlly2av/siglogo.png[/img] My mods (Links coming soon) Cities | Roads | Remula | SilvaniaMod | MoreStats
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.