Skip to content

CreativeTabsHelper

MCE626 edited this page May 1, 2019 · 2 revisions

CreativeTabsHelper will allow you to make creative tabs with this library, complete with a tab icon, search bar functionality and even changing the label color.

Examples

Put this in your main mod class file.

public static CreativeTabs tab = new CreativeTabsHelper("name", true){
    @Override
    @SideOnly(Side.CLIENT)
    public ItemStack getTabIconItem(){
        return new ItemStack(ModBlocks.RANDOM_BLOCK);
    }
}.setLabelColor(EnumDyeColor.CYAN).setSearchbarWidth(75);

Here, the string "name" is the unlocalized name for the tab, and will show up as itemGroup.name. The boolean after that is for whether or not the creative tab should have the search bar. If set to true, the setSearchbarWidth will be used. The setLabelColor method will set a color to the name of the tab. You can either use a decimal number or use an EnumDyeColor. You can get a decimal number for the color by converting Hex to Dec.

References