Jump to content

[1.9.4] [SOLVED] getItemModelMesher().register vs setCustomModelResourceLocation


Recommended Posts

It took me a while to figure this out so I thought I'd share my experience hoping to save someone else some time.  (Re as: share the pain.)


I was updated a working 1.8.9 mod to 1.9.4 and for the life of me couldn't get the setCustomModelResourceLocation calls to set up the textures.  I did a lot of searching and debugging and finally traced it down to the fact that the items were not in the ItemModelMesher.  Wait, what does the ModelMesher have to do with it, aren't we supposed to use the ModelLoader?  I honestly have no idea since I really haven't spent the time to see how the rendering pipeline works.


What I did find is that the ModelLoader and the ItemModelMesher have different lists.  There is a routine called onRegisterItems in ModelLoader that moves all the registered things into ItemModelMesher.


It wasn't moving mine and I traced it down to the fact that I was doing all my old old calls to getItemModelMesher().register in init NOT preinit!  Yup!  My mistake.  However, there were no errors anywhere in the log telling me that it was going to fail because I was doing it "too late."


Once I knew this all the tutorials did say "do in preinit" but I missed that part and since it did work in 1.8.9 I just figured it was the right place.


Anyway, hope this helps someone else out.

Link to comment
Share on other sites

Right, the mesher's timing was very sensitive. Not only did it need to wait until Init, but it had to be in the right order with some other things and it was easy to screw up, hence it was deprecated (and there's a special level of modder Hell reserved for tutorial writers who subsequently told people to use it anyway).


As several forum experts have mentioned in about 100 threads here over the last year+, the loader can and should be called in preInit. It is preferred because it's timing is not subject to the same disruption as the mesher.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.

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.