Jump to content

[1.11.2] Event for registering recipes?


MSpace-Dev

Recommended Posts

So, as we may know, GameRegistry.register(); is not used anymore. And I have see that we use RegistryEvents to register items and blocks. Yet the only way I can find to register recipes is through GameRegistry.addRecipe. Is this still correct, or is there a new event that is used to register recipes within the game? Also, if there is no other way, when do I call the registerRecipes() function?  preInit() |  Init() |   postInit() ?

Edited by MSpace-Dev
Link to comment
Share on other sites

Recipes are now managed by a Forge registry, so IRecipe extends IForgeRegistryEntry and instances of it should be registered in RegistryEvent.Register.

 

As Kokkie said, you should use JSON files wherever possible. You can register your own recipe, ingredient and condition factories to extend the JSON system.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I have a question about the JSON files. Do you really have to have 1 JSON file per recipe? I have this at the moment, can I add another recipe in this file?

 

{
  "type": "crafting_unshaped",
  "pattern": [
    "III",
    "III",
    "III"
  ],
  "key": {
    "I": "boe:tin_ingot"
  },
  "result": { "item": "boe:tin_block" }
}

 

Edited by MSpace-Dev
Link to comment
Share on other sites

1 hour ago, MSpace-Dev said:

I have a question about the JSON files. Do you really have to have 1 JSON file per recipe? I have this at the moment, can I add another recipe in this file?

 

It's one JSON file per recipe, yes.

 

 

1 hour ago, MSpace-Dev said:

Also, what version do JSON recipes work in? From what version onwards?

 

Cause, I have my suspicions that it is 1.12 onwards, but I'm only in version 1.11.

 

Ah, I missed the version in the thread title. JSON recipes and the recipe registry were added in 1.12, 1.11 still uses the old recipe list system.

 

In 1.11 and earlier, recipes should be registered in init.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.