Jump to content

How should I register this?


DreamingInsanity

Recommended Posts

I can tell this has been asked a lot, and yes before you tell me I did look at the common problems and issues section but it didnt help.

 

FYI: This is my first mod, so I am just following a tutorial.

 

I am trying to register my item, yet whenever I run the game it crashes on the 2/7 stage.

public class CustomItems 
{
	public static Item CustomItem;
	
	public static void preInit()
	{
		CustomItem = new Item().setUnlocalizedName("custom_item").setCreativeTab(CircleMod.extraTab);
		registerItems();
	}
	
	public static void registerItems() 
	{
		ForgeRegistries.ITEMS.register(CustomItem);
	}
	
	public static void registerRenders() 
	{
		registerRender(CustomItem);
	}
	
	public static void registerRender(Item item) 
	{
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(CircleMod.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	}
}

That is roughly what the tutorial say to use, although it has minor tweaks because the tutorial is for 1.10 and i'm in 1.12.

I get the error: 

Can't use a null-name for the registry, object net.minecraft.item.Item@166fa7ab.

I did a fair amount of research into it but I couldn't find anything that would help.

My full log: https://pastebin.com/0jifnRW9

 

I hope this isn't "spam"!

Thanks in advance,

Dream.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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