Minecraft 1.12 modding with forge – 9 – Custom Creative Tab

Hello everyone! In this tutorial I am going to show you how to make custom Creative Tabs, with custom background, name and icon.

Making a creative tab is really easy, I will make them in my ModItems class because I won’t be making a lot of them.
In the ModItems class create a new final static variable, it will be of type CreativeTabs, I will call it tabTutorialMod. You can also instantiate it on the same line, but this will give an error. This is because you need to implement a method. You can do that right after where you instantiate the variable by adding a curly bracket ({), and between the brackets you can override the getTabIconItem method. This should return an ItemStack. The ItemStack you return is the item that will be displayed in the creative tab menu. I will use the tutorialDust item.
It should look a little like this:

This is all you have to do to create a CreativeTab. Now you can add

itemGroup.tabTutorialMod=TAB NAME

to your lang file. If you just want a CreativeTab this is all you need to do, you can now add items to it by referencing to the tabTutorialMod variable while calling setCreativeTab on an Item. But if you want a custom background or you want your CreativeTab to be searchable you can continue reading.

 

Custom CreativeTab with all of the items we created

Here you can see all of the items we created so far in the CreativeTab we just created. Minecraft automatically adds the buttons to switch pages.

To make your CreativeTab be searchable you should override hasSearchBar so that it returns true. But because the searchbar is in the background the searchbar will look like it isn’t there.
To change the background call setBackgroundImageName on the tabTutorialMod. To get the default minecraft search background pass it “item_search.png”.

And this will be the result:

Now if you want a custom background you can change change what you pass in setBackgroundImageName. Minecraft will search in the assets\minecraft\textures\gui\container\creative_inventory folder for a file named: “tab_BACKGROUNDNAME”. So if you pass “tutorialbackground” it will search for tab_tutorialbackground. In your assets folder you should create a folder structure like this: minecraft\textures\gui\container\creative_inventoryAnd in the creative_inventory folder you put the image with the correct name. For the vanilla textures you can check an unchanged JAR or in your Reference Libraries. They are under assets\minecraft\textures\gui\container\creative_inventory. (I won’t post them here because I don’t know the copyright rules).

That was everything for this part, I know this part is way too late but I am very busy with school. As always if you have any question don’t hesitate to ask in the comments! Also if you saw any errors in the tutorial please let me know so I can fix it!

~suppergerrie2

Posted in Forge tutorial, Forge Tutorial 1.12.

5 Comments

  1. wait nvm got it but u might need to be a bit more specific for where the code bit goes for all the new mod devs but otherwise! only one that has worked

  2. Could you possibly teach how to organize a creative inventory? I have items located all over the place within my creative tab and I can’t find out how to organize them.

    • You can override displayAllRelevantItems in your creative tab and sort the list that gets passed in on whatever system you want. (Like on name, or on tier).

Leave a Reply

Your email address will not be published. Required fields are marked *