Jump to content

How Do I Put My Items In My Creative Tab? (1.10.2) [solved]


Recommended Posts

Posted

I am able to put things in other tabs.... but not the one I just created.

 

How do I put my items in my own tab? here's what I got:

package guru.tbe;

import net.minecraft.creativetab.CreativeTabs;

public class ModCreativeTabs {

public static CreativeTabs TheBasicElements;

public static void load(){

	TheBasicElements = new TBECreativeTab(CreativeTabs.getNextID());
}
}

 

package guru.tbe;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;

public class TBECreativeTab extends CreativeTabs {



public TBECreativeTab(int id) {
	super("TheBasicElements");
	//this.setBackgroundImageName("item_search.png");
}

@Override
public Item getTabIconItem() {
	return guru.tbe.init.GuruItems.NetherOrb;
}

}

 

itemGroup.TheBasicElements=The Basic Elements
item.AirOrb.name=Air Orb
item.EarthOrb.name=Earth Orb
item.FireOrb.name=Fire Orb
item.WaterOrb.name=Water Orb
item.NetherOrb.name=Nether Orb
item.InvisibleOrb.name=Invisible Orb
item.CreativeOrb.name=Creative Orb

 

public static void init()
{
	Item item = (new ItemBucket(Blocks.AIR)).setUnlocalizedName("bucket").setMaxStackSize(16);
	AirOrb = new ItemAirOrb().setUnlocalizedName("AirOrb").setMaxStackSize(64).setCreativeTab(CreativeTabs.COMBAT);
	WaterOrb = new ItemWaterOrb().setUnlocalizedName("WaterOrb").setContainerItem(item).setMaxStackSize(64).setCreativeTab(CreativeTabs.COMBAT);
	EarthOrb = new ItemEarthOrb().setUnlocalizedName("EarthOrb").setMaxStackSize(64).setCreativeTab(CreativeTabs.COMBAT);
	FireOrb = new ItemFireOrb().setUnlocalizedName("FireOrb").setContainerItem(item).setMaxStackSize(64).setCreativeTab(CreativeTabs.COMBAT);
	NetherOrb = new ItemNetherOrb().setUnlocalizedName("NetherOrb").setMaxStackSize(64).setCreativeTab(CreativeTabs.COMBAT);
	InvisibleOrb = new ItemInvisibleOrb().setUnlocalizedName("InvisibleOrb").setMaxStackSize(64).setCreativeTab(CreativeTabs.COMBAT);
	CreativeOrb = new ItemCreativeOrb().setUnlocalizedName("CreativeOrb").setMaxStackSize(64).setCreativeTab(CreativeTabs.MISC);
}

 

 

When I change:

AirOrb = new ItemAirOrb().setUnlocalizedName("AirOrb").setMaxStackSize(64).setCreativeTab(CreativeTabs.COMBAT);

 

To:

AirOrb = new ItemAirOrb().setUnlocalizedName("AirOrb").setMaxStackSize(64).setCreativeTab(CreativeTabs.TheBasicElements);

 

It does not work.

I have also checked to see if this would work:

AirOrb = new ItemAirOrb().setUnlocalizedName("AirOrb").setMaxStackSize(64).setCreativeTab(TBECreativeTab.INVENTORY);

 

no red... but still doesn't work and item doesn't appear.

 

I can't get my items to appear in my tab :| *sigh*

Posted

and again... no red but no item in the tab.

 

AirOrb = new ItemAirOrb().setUnlocalizedName("AirOrb").setMaxStackSize(64).setCreativeTab(ModCreativeTabs.TheBasicElements);

Posted
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VERSION)
public class Guru
{
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
@Instance(Reference.MOD_ID)
private static Guru instance;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	proxy.preInit();
	GuruItems.init();
	GuruItems.register();
	GuruEntities.registerEntities();
	ModCreativeTabs.load();
	initRecipes();
}
    @EventHandler
    public void init(FMLInitializationEvent event)
    { 
	proxy.registerRenders();
        proxy.registerKeybindings();
        NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
    }	
private static void initRecipes()
{
	GameRegistry.addRecipe(new ItemStack(GuruItems.AirOrb), new Object[] {" X ", "X X", " X ", 'X', Items.FEATHER});
	GameRegistry.addRecipe(new ItemStack(GuruItems.WaterOrb), new Object[] {" X ",  "X X", " X ", 'X', Items.WATER_BUCKET});
	GameRegistry.addRecipe(new ItemStack(GuruItems.EarthOrb), new Object[] {" X ",  "X X", " X ", 'X', Item.getItemFromBlock(Blocks.DIRT)});
	GameRegistry.addRecipe(new ItemStack(GuruItems.FireOrb), new Object[] {" X ",  "X X", " X ", 'X', Items.LAVA_BUCKET});
	GameRegistry.addRecipe(new ItemStack(GuruItems.NetherOrb), new Object[] {" X ",  "X X", " X ", 'X', Item.getItemFromBlock(Blocks.OBSIDIAN)});
}
public static Guru getInstance()
{
	return instance;
}
}

Posted

Theres not really a whole bunch of info to learn this stuff on... the only guide i could find on youtube was in german man, im just doing what i can. Thats all i can do.

 

Posted

You create your items (

GuruItems.init

) before you call

ModCreativeTabs.load()

so when you call

setCreativeTab

on your items,

ModCreativeTabs.TheBasicElements

is null so you're effectively calling

setCreativeTab(null)

. You need to initialize your creative tab before you create your items/blocks.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Posted
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	ModCreativeTabs.load();
	proxy.preInit();
	GuruItems.init();
	GuruItems.register();
	GuruEntities.registerEntities();
	initRecipes();
}

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.