Jump to content

[1.14.4] Alternative for 'setCustomModelResourceLocation'


Recommended Posts

Posted

This is a question I thought I figured out a while ago, but I guess not.

I have 40+ items that get auto-generated and shoved into a map at runtime.

I want all of these items to share the same model to save on load times and allow for easy expansion. This could be achieved in the past by using ModelLoader#setCustomModelResourceLocation, but that's obviously not an option anymore.

What is the correct way of achieving this nowadays?

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Posted
26 minutes ago, diesieben07 said:
  1. You should not be dynamically generating items.
  2. All items must have a model file (usually JSON). There is no way to bypass this.

Without dynamic generation or shared resources, I would have to manually write ~5-6 items and their resources just to add a single new variant, of which I intend to have over a dozen. The alternative to either of those would be to use single items with NBT, which is also usually discouraged. Honestly I don't like any of my options.

 

This is a very old project that I'm trying to flatten. The items (used to) use a system akin to Forestry's honeycombs, with item metadata and potentially hundreds of variants. Writing some scripts to do some code/file generation might be a last resort, but things would be getting out of hand at that point.

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Posted
21 minutes ago, diesieben07 said:

It's fine to have a static set of variants and then write code to register items for them.

It's not fine to read data from e.g. a config file and then use that to decide which items to register.

Ah right, I guess I wasn't clear when I said "generating items", what I have should be fine then.

22 minutes ago, diesieben07 said:

For the generation of the JSON files you can look into data generators.

Oh! Forgot about those, thanks for mentioning them. Guess I'll dive into that. I was worried that a bunch of JSON models would degrade performance, but I'll cross that bridge when I come to it.

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

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.

Announcements



×
×
  • Create New...

Important Information

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