Jump to content

Recommended Posts

Posted

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

Posted

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);

}

Posted

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

Posted

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!

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

×
×
  • Create New...

Important Information

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