iiBlake Posted August 21, 2016 Share Posted August 21, 2016 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 More sharing options...
MCrafterzz Posted August 21, 2016 Share Posted August 21, 2016 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); } http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod] Link to comment Share on other sites More sharing options...
imadnsn Posted August 21, 2016 Share Posted August 21, 2016 override Item.getSubItems(Item, CreativeTabs, List<ItemStack>) if you don't already, you return the list after adding all the sub-items of the item you are making so it can be shown in the creative tab Link to comment Share on other sites More sharing options...
MCrafterzz Posted August 21, 2016 Share Posted August 21, 2016 The registerItem will proberly get removed so I copyied it, how should I otherwise do? http://i.imgur.com/J4rrGt6.png[/img] [Creator of mcrafterzz mod] Link to comment Share on other sites More sharing options...
TheGreyGhost Posted August 21, 2016 Share Posted August 21, 2016 Hi You might find this example project useful https://github.com/TheGreyGhost/MinecraftByExample mbe08 shows how you can add items to creative tabs https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe08_creative_tab -TGG Link to comment Share on other sites More sharing options...
iiBlake Posted August 22, 2016 Author Share Posted August 22, 2016 I got this fixed, thanks for all the help! Turns out it was because i was setting the tabs in preInit(or not?), but once i moved the tab setting into Init it worked fine. Thanks for the help again! Link to comment Share on other sites More sharing options...
Recommended Posts