Jump to content

Items not being added to custom CreativeTabs


iiBlake

Recommended Posts

Hello, I'm relatively new to modding but not java, and i was trying to add new items and blocks. Everything is working so far, except the creativetab part. I can get my items with /give, but they are just not showing in my creative tab. I am creating the creativetab like so:

modTab = new ModTab("testmod", wrench);

, and my ModTabs constructor is:

public ModTab(String label, Item i) {
	super(label);
	tabIcon = i;
}

.

I register my items with a method called 'register', and inside that it registers them to gameregistry and sets the creativetab:

private void register(Item item){
	GameRegistry.registerItem(item, item.getUnlocalizedName());
	item.setCreativeTab(modTab);
}

. I also have one for blocks, the same but with registerBlock. Any help would be appreciated!

 

P.S. Sorry for formatting issues, new to forum

Link to comment
Share on other sites

Also don't use register item, change it to:

public static void registerItem(Item item) {

String name = item.getUnlocalizedName().substring(5);

if (item.getRegistryName() == null && Strings.isNullOrEmpty(name))

throw new IllegalArgumentException("Attempted to register a item with no name: " + item);

if (item.getRegistryName() != null && !item.getRegistryName().toString().equals(name))

throw new IllegalArgumentException("Attempted to register a item with conflicting names. Old: "

+ item.getRegistryName() + " New: " + name);

GameRegistry.register(item.getRegistryName() == null ? item.setRegistryName(name) : item);

item.setCreativetab(modTab);

}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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