Jump to content

[1.10.2] When and How should I register the rendering?


LaureeGrd

Recommended Posts

I'm using a method inside my Item class to register the ItemRenderer by calling

ModClass.proxy.registerItemRenderer(this);

 

This method is empty on CommonProxy obviously but on ClientProxy it calls

 

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

 

Since the method inside my Item class is called just after registering the item, it is from preInit.

Should I do it differently? Should I do it the same way but on init or postInit? Thanks in advance.

Link to comment
Share on other sites

I'm using a method inside my Item class to register the ItemRenderer by calling

ModClass.proxy.registerItemRenderer(this);

 

This method is empty on CommonProxy obviously but on ClientProxy it calls

 

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

 

Since the method inside my Item class is called just after registering the item, it is from preInit.

Should I do it differently? Should I do it the same way but on init or postInit? Thanks in advance.

In preInit after registration or before? I dont think it matters.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I'm using a method inside my Item class to register the ItemRenderer by calling

ModClass.proxy.registerItemRenderer(this);

 

This method is empty on CommonProxy obviously but on ClientProxy it calls

 

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

 

Since the method inside my Item class is called just after registering the item, it is from preInit.

Should I do it differently? Should I do it the same way but on init or postInit? Thanks in advance.

In preInit after registration or before? I dont think it matters.

 

Thanks. I was worried since I saw some codes where they call a static method that registers all the renderers together in Initialization

Link to comment
Share on other sites

The difference is between using ModelLoader.setModelResourceLocation(item, meta, location) and Minecraft::register(item, meta, location). The prior will get called in preInit and the later after preInit. The later is also really finicky about what happens before/after so stick with ModelLoader version.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

The difference is between using ModelLoader.setModelResourceLocation(item, meta, location) and Minecraft::register(item, meta, location). The prior will get called in preInit and the later after preInit. The later is also really finicky about what happens before/after so stick with ModelLoader version.

Very useful. Thanks!

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.