The Meaning of Life, the Universe, and Everything.
Join Date:
9/11/2012
Posts:
120
Minecraft:
Saegusae
Member Details
i'll keep this pretty simple and easy there is a class file in minecraft source called CreativeTabs
we'll use it to make anything we need in this tutorial
first add this to your mod_*** class
i'm working on my mod so i'll use a piece of code from it...
public static final CreativeTabs tabMSMBlock = new TabMSMBlock(12, "moreBlocks");
public static and final prefixes pretty much explain themselves so.
call the CreativeTabs class in this code and give your tab a temporary name mine is "tabMSMBlock"
12 is the id of the tab and it tells the game to display this tab in the second page...(you'll see) the string "moreBlocks" is the name that you'll use in your language files which i'll not cover in this tutorial but include it anyways so let's make the "TabMSMBlock" class make a class file and name it that
so let's take a look at the code
public final class TabMSMBlock extends CreativeTabs
{
public TabMSMBlock(int par1, String par2Str)
{
super(par1, par2Str);
}
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
return mod_MSM.marble.blockID;
}
public String getTranslatedTabLabel()
{
return "More Blocks";
}
}
make sure you extend CreativeTabs.class
i'll only explain the methods the getTabIconItemIndex() method explains itself it's the item or the block that you want the icon on the tab.
aand the String getTranslatedTabLabel() is the title of the tab. if you choose not to use this string you'll see something like "itemGroup.moreBlocks" in the title section that's because the translation for the title isn't included in the main translation files...
just use this method to cover that that's pretty much it. and at last use the .setCreativeTab method o your items like that.
Nice but with Forge you don't need to name your class mod_*** as FML (ForgeModLoader) doesn't need BaseMod to function. And judging by how you don't have an icon set, did you follow my tutorial? Because if you did I would like to see credit and also I have added a tutorial for icons.
Rollback Post to RevisionRollBack
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
Theres a problem when I do it. I can click it and everything but when I try to add blocks/items they don't show up. I've had the same problem with other creative tabs too. could you try adding some mod items to the tab and actually testing it out in game?
Theres a problem when I do it. I can click it and everything but when I try to add blocks/items they don't show up. I've had the same problem with other creative tabs too. could you try adding some mod items to the tab and actually testing it out in game?
Firstly, it does work, I have my mod set up with a custom tab, secondly please post your code in spoilers.
Rollback Post to RevisionRollBack
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
I am having the same issue as mineputer12345678. I have a very basic setup, and a Block set to display on my tab. The tab displays, and with the correct texture (the same as the Block I'm hoping to add to it), but my Block doesn't show up. To make matters worse, it doesn't show up in any of my Creative inventory tabs at all. If I change the tab to a default tab (tabBlock, for example), it will show up, and I can place it and everything.
but (maybe if you remove the side proxy line of code it might work)
I would use Forge for the mod I'm making, but I've had my problems with custom models on that, so i decided just to use ModLoader.
And i already tried to remove the side proxy line.
we'll use it to make anything we need in this tutorial
first add this to your mod_*** class
i'm working on my mod so i'll use a piece of code from it...
public static and final prefixes pretty much explain themselves so.
call the CreativeTabs class in this code and give your tab a temporary name mine is "tabMSMBlock"
12 is the id of the tab and it tells the game to display this tab in the second page...(you'll see) the string "moreBlocks" is the name that you'll use in your language files which i'll not cover in this tutorial but include it anyways so let's make the "TabMSMBlock" class make a class file and name it that
so let's take a look at the code
make sure you extend CreativeTabs.class
i'll only explain the methods the getTabIconItemIndex() method explains itself it's the item or the block that you want the icon on the tab.
aand the String getTranslatedTabLabel() is the title of the tab. if you choose not to use this string you'll see something like "itemGroup.moreBlocks" in the title section that's because the translation for the title isn't included in the main translation files...
just use this method to cover that that's pretty much it. and at last use the .setCreativeTab method o your items like that.
use the second one only if the constructor of your item is in the same class as your "tabMSMBlock" constructor
cheers and be sure to check out my mod when it comes out (also i'm looking for some texture artists any help appreciated)...
Have you made your necessary imports ...
What is the error ...
also instead of using a number like 12 try this code picks an automatic number simply replace 12 with this CreativeTabs.getNextID()
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
part of code
Nice, just a hint, never make the item that is the icon have a shiny effect, it screws up quite a bit...
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
Firstly, it does work, I have my mod set up with a custom tab, secondly please post your code in spoilers.
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
Np!
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
Here's my code:
TimeTravelMod.java
There are a couple other classes in my mod so far, but nothing pertinent to this.
and try changing
to
Edit: and just found out you register the block before the tab try changing their place...
My tab subclasses CreativeTabs (obviously), which has a constructor that uses only one parameter, and sticks your (my) tab in the next available id
So my tab shows up fine, I was just having an issue with the blocks showing up.
And I was told the same thing about switching their places, but I'll have to try it when I get home from work
Also, is there a limit to how many tabs you can have?
but (maybe if you remove the side proxy line of code it might work)
I would use Forge for the mod I'm making, but I've had my problems with custom models on that, so i decided just to use ModLoader.
And i already tried to remove the side proxy line.
Alright np