Ornamental

Ornamental

286k Downloads

Registration Rework

Andromander opened this issue ยท 2 comments

commented

Ornamental's registry is self-contained but also quite inefficient. This serves to deal with at least two of these issues.

Registration

The first thing to address is registration. Currently, all registration methods are private and therefore each addon must make their own registration methods. While this does mean the addons that add their own blocks are capable of registering themselves, it's often more tedious to the addons that don't add anything new.

Change access to registration methods as public

Namesake, this makes the methods easy to access.

All-encompassing registration method

This one's just to filter every registration method into the one method. Will exist for any edge cases where a new method is necessary and other methods don't provide.

Per-ornament registration methods

This is what's present in the mod already, just needs to be splintered up to use the all-encompassing registration methods and accept all kinds of ornaments that extend their class.

Data Generation

Though this is irrelevant for the player as these are never run in the game, there still remains a glaring issue that data generation is inefficient. A lot of repetition, cramped classes, just generally very slow to add blocks these days if not tedious or high maintenance. What I plan to address is a majority of the issues such as recipe and tag generation.

This may need me to engineer a new system that could potentially work like OrnamentBuilder but for generation.

Tags

Currently, all the blocks viable for a certain tag are pushed into an ImmutableSet and then that ImmutableSet is iterated and adding to a Tag. This screams inefficient. Instead, this could very easily be done at registration time, creating a list of tags a registry entry is valid for and adding to it during that time, then with those lists, add it to generation.

Recipes

Again, these are all fairly identical, the only differentiation is that some recipes make use of "override" recipes should they need it. One thing to note is that all these recipes make use of a common "big" and "small" item, and the override recipes make use of a Tag.

Loot Tables

Also another culprit of identical generation, some blocks also share the same generation method. Honestly, even thinking of a mod context, there's not really any sort of edge-casing going on, though I will still try to consider ways to generate with consideration for mods.

Blockstate and Item Model Generation

Now, this one is a bit more tricky because some blocks will differ between each other. Ultimately, this might be left untouched, maybe have some "default" methods that are automagically done, but keep the more specially-handled blocks and items in the data generator as is.

commented

Add to this list thanks to 1.19.3: Creative Tabs.

commented

I'm calling this done as most of what I can do here is the best that can be done. Not sure about handling the rest of data generation like this; Tags are already a bit iffy on generation though passable.