Jump to content

MC 1.14+ Registration and handling of lots of items


jdanek

Recommended Posts

Hi, I want to ask you for some tips and best practices on how to proceed correctly in some cases of making a modification.

I am new to Java and modifying, I have experience with PHP programming and development of plugins for the content management system. So I apologize in advance if anyone finds my questions Noobic.


Before I decided to write here, I spent a lot of time searching for information on Google. The answers I found and looked like the right ones for my questions were often on version 1.12.2. This means often unusable for version 1.13+.

 

Many of you certainly know the Gregtech mod (loved and hated), it is a modification that adds a lot of types of machines, blocks, materials and fluids. I do not intend to make another copy of this mod, I use it only as a comparison to understand my questions.

 

Additional components are then formed from the individual materials (for example: tiny / small / pure dusts, ingots and plates). If I read correctly then since MC 1.13+ a JSON file is created for each item, so the procedure from 1.12.x when one "uni-dust" was created with many variants or metaitems based on the getDamage method is now unusable.

By going through the existing modifications on GitHub, I found that most moders register each item separately and use so-called object holders. So then the item can be treated like this ModName.ITEM_NAME.get(). Suppose GT has about 500 types of materials, each material would have about 40 variants of components - ore, block, some dusts, plates, ingots (+ doubled, ...) gears, screws ... Yes, some materials have fewer, this is just a consideration. That's around 20k items ?, keeping it in object holders probably won't be easy. Cycle registration is offered, but these items will not be easily accessible.

 

And since adding 20k items (+20k JSONs) is also hardcore, it occurs to me that the solution would probably be to create one item (like a colorable backpack). This would actually create only those 40 variants, and their properties would be somewhere in the NBT. Unfortunately, I read somewhere that it is less efficient to create a separate item than an NBT "God" item precisely because of the amount of data associated with the manipulation of such an object.

 

I went through many mods, small and familiar, and I didn't get satisfactory answers. And as I wrote above, I'm a beginner in this and some procedures so far there is nowhere to look, because a lot of mod is still in the version for 1.12.2

 

How to solve such a problem, which way to go? Again, I use GT only as an example, because it is a well-known mod.

Textures can be colored, but how to subsequently solve JSONs in assets. I know you can use a datagen, but 20k JSONs are overkill.

Link to comment
Share on other sites

Yes I understand your question and I can see 20k JSONs being overkill but if you see the vanilla code, that's pretty much the approach taken.

 

For example, the clock item changes texture depending on the time of day in a gradual manner. The way vanilla goes about this can be seen in my attached image. 

 

Did you see it? yeah... it might seem like overkill (and it actually doesn't stop at 40, it goes up to 63) but that's how it's done.

 

Datagens will reduce your workload a bunch and all you need to do then it preferably order your JSONs in folders in order to organize them. 

 

Good luck! I know this answer wasn't helpful but at least I hope its inspiring or idk haha.

 

Screenshot 2020-04-22 at 9.20.19 PM.png

  • Like 1
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.

Announcements



×
×
  • Create New...

Important Information

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