Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[Forge] [Resolved] How do you add a tab to the Creative GUI?


  • Please log in to reply
5 replies to this topic

#1

MoparDan
    MoparDan

    Zombie Killer

  • Members
  • 203 posts

Posted 06 November 2012 - 04:27 PM

I have seen other mods that add their own tab to the creative GUI (EE3 and steve's carts for example), and I am completely baffled on how they do it.

Would it be possible for someone to point me in the right direction as to how you do this?

Thanks in advance.
The Best Post Ever Made On Minecraft Forums! A Must Read!

SalZoRz said:

Speaking of attention grabbing titles.  Do you know what stickies are?

Newbunkle said:

Wait, you mean not everything works in unfinished games? :S

Register or log in to remove.

#2

dmillerw
    dmillerw

    Nether Resident

  • Curse Premium
  • Curse Premium
  • 2160 posts
  • Minecraft: dmillerw

Posted 06 November 2012 - 04:39 PM

It's a feature built in to Forge. I'm assuming you're using Forge? Make a new class that extends CreativeTab, register it, then use that custom tab when referring to the tab your items should display on.

public static final CreativeTabs tabName = new YOUR_TAB_FILE();
...
.setCreativeTab(CLASS_YOU_REGISTERED_TAB_IN.YOUR_CREATIVE_TAB);
...


#3

MoparDan
    MoparDan

    Zombie Killer

  • Members
  • 203 posts

Posted 06 November 2012 - 08:25 PM

Thank you very much dmillerw, greatly appreciated, and yes, this is with forge.

I do have one last issue if you could help me out with it.

I got the tab to show up, no issues there (and again, many, many thanks to you for that), but regardless of how I try to set the name of the tab, it keeps showing up as "itemGroup.MyTab".

I tried registering it as:
public static final CreativeTabs MyTab = new MyTab("My Tab");

But then in game I just end up with a tab called "itemGroup.My Tab".

I also tried:
LanguageRegistry.addName(MyTab, "My Tab");

But minecraft just vomits all over me for trying to take a shortcut like that, so I thought I would try this inside my MyTab class file:

public String setTabLabel(){
return "My Tab";

}

But that doesn't seem like it does anything. Any ideas on where I am failing at?
The Best Post Ever Made On Minecraft Forums! A Must Read!

SalZoRz said:

Speaking of attention grabbing titles.  Do you know what stickies are?

Newbunkle said:

Wait, you mean not everything works in unfinished games? :S

#4

demonicjoker
  • Location: Elysium Dark Realm
  • Minecraft: DemonicJoker

Posted 07 November 2012 - 06:47 AM

I fixed it, i don't know how proper this is but hey i'm sure it works

Replace

public String setTabLabel(){
return "My Tab";
}


with this


public String getTranslatedTabLabel()
{
return StringTranslate.getInstance().translateKey("" + this.getTabLabel());
}
public String getTabLabel()
{
return "MyTab";
}

_____________________________Programmer For The Mod Elysium_______________________________

Posted Image


#5

MoparDan
    MoparDan

    Zombie Killer

  • Members
  • 203 posts

Posted 07 November 2012 - 01:48 PM

Very nice, Thank you very much with this! I seen this in the vanilla code but couldn't track down where it was pulling the actual name from so I didn't follow up on it.

Again, thank you, greatly appreciated!
The Best Post Ever Made On Minecraft Forums! A Must Read!

SalZoRz said:

Speaking of attention grabbing titles.  Do you know what stickies are?

Newbunkle said:

Wait, you mean not everything works in unfinished games? :S

#6

RustySheep
  • Location: The universe
  • Minecraft: WoolHouse10

Posted 20 April 2013 - 03:18 PM

Instead of doing what demonic said, you can easily add this code (fetched from the FML wiki) to your @Init method:
LanguageRegistry.instance().addStringLocalization("itemGroup.tabCustom", "en_US", "My Custom Tab");
Replace the string "My custom tab" with your tab name, such as "My Mods' Ores" or something, and replace the tabCustom in the string "itemGroup.tabCustom" with your tab's name, such as "itemGroup.tabMymodsores". Hope this helps.