Jump to content

[1.12] What event should Ore Dictionary registrations happen?


jabelar

Recommended Posts

I previously followed the advice in the forge documentation (https://mcforge.readthedocs.io/en/latest/utilities/oredictionary/) to register the ore dictionary entries "during the FMLPreInitializationEvent phase, after initializing the blocks and items that you will register".

 

However, now the blocks and items have their own registry events and I believe (based on looking at my console output) that the PreInit is actually before these registry events. So I'm guessing that ore dictionary should be registered in the item registry event after the items? Or is there a dedicated ore registry event?

 

On a related note, how can I tell which things have now have registry events? I tried to follow the code but most of it seems to give generics and I could only find where the block, item and recipe events were fired. But I think potions and biomes are also now using registry events? What is best way to see list of what has such events?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

1 hour ago, jabelar said:

Or is there a dedicated ore registry event?

No, there isn't.

 

1 hour ago, jabelar said:

So I'm guessing that ore dictionary should be registered in the item registry event after the items?

You do it whenever you want. Since other mods might query oredict to enable some kind of compatibility I would suggest duing it during init(as mod compatibility should happen in post-init according to docs anyway) or in registry event directly as you've suggested.

 

1 hour ago, jabelar said:

On a related note, how can I tell which things have now have registry events?

If it implements IForgeRegistryEntry(or extends IForgeRegistryEntry.Impl) then it has a registry event(well actually rather if it has a registry then there is an event but in vanilla there is a registry for evey IForgeRegistryEntry implementation). Just lookup the usages in your IDE.

Edited by V0idWa1k3r
Link to comment
Share on other sites

8 hours ago, V0idWa1k3r said:

You do it whenever you want. Since other mods might query oredict to enable some kind of compatibility I would suggest duing it during init(as mod compatibility should happen in post-init according to docs anyway) or in registry event directly as you've suggested.

Honestly, you should probably do it "as early as you can."

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

5 minutes ago, Draco18s said:

Yeah, I was debating with myself whether I should do it in the Item registry event or the IRecipe registry event. I think at the end of the Item registry event is best because that is sure to happen after my items are registered but before my mod or any other mod registers their recipes. So then another mod presumably could register ore dictionary recipes against my ore dictionary entries.  Since the registries use string keys, perhaps the order doesn't matter so much but seems safest to me.

EDIT: Actually giving it more thought, I think it depends on whether you want to register ores against other mods or vice versa. If you want your stuff to act like another mod you'll probably want to ensure the other mod's items are already registered, so then the IRecipe registry event might be better.

Edited by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

You done gone fucked up trying to quote me and put your rely inside the quote.

 

In any case, in theory, a recipe registered with an oredict reference will work even if that oredict entry doesn't exist at the time of recipe creation (but does later) because the recipe actually operates on those strings when you use the crafting table. I've never messed around with it though.

 

But it might screw up something else (e.g. "don't register this recipe unless oredict entry exists")

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 hour ago, jabelar said:

Draco, yes I also expect it is somewhat tolerant since it registers string keys rather than actual instances so probably works in various orders.

Mhm.

Of course, I've intentionally delayed one particular oredict registration before, as I needed to know "has any mod registered X?" before I registered my own, having registered my own it would have been more troublesome to figure out (as mine was going to get registered anyway, but I had to do another operation first).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.