Jump to content

Creation/registering of recipes for custom machines (1.15.2)


Asleep365

Recommended Posts

The mod I'm currently working on creating has custom furnaces/machines that will take in multiple inputs (fuel, multiple resources, containers) and produce multiple outputs (solid, liquid, gas, and ash from spent fuel). Currently my machine processes vanilla furnace recipes, but my goal is for the machine to process recipes in the format {unordered set with between 1-3 items}+[gas input (optional)] + [bool endothermic?] + [catalyst (optional)] -> number*[solid (optional)] + number*[liquid (optional)] + number*[gas(optional)]. The specifics of implementation aren't a major issue at the current time, I'm pretty confident with my general programming knowledge.

I know how to register vanilla crafting table and furnace recipes, but I'd like to know if there is a means to process any generic multiple input->multiple output formulas from JSON without hardcoding all the recipes. Vanilla code like the firework crafting recipe processes a variable numbers of ingredients in a crafting recipe, but I would still effectively be hard-coding each recipe type. As I'm expecting ~300 unique recipes in total I'd prefer to isolate the recipes in an easily accessed format, otherwise I'll probably just make it like in vanilla with a function that takes in the relevant inputs and after running through hard-coded recipes produces a struct containing the output info, then I can process what the machine does from there.

 

Link to comment
Share on other sites

What popoodice said plus, you can take a look here to see some examples of custom recipe implementations, their serializers and how to register them: https://github.com/Beethoven92/BetterEndForge/tree/master/src/main/java/mod/beethoven92/betterendforge/common/recipes

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

In the examples for IRecipes you gave and in vanilla minecraft they override the functions ItemStack GetCraftingResult() and GetRecipeOutput(), which each have exactly one output by design, and the concept is that for each product item they have recipes to produce that one product, thus why each recipe is named after the output. Instead I'm trying to have a generic a+b+c->d+e+f, but since there's nothing in IRecipe forcing me to use those functions, I might be able to just have similar ones with a class/struct return value.

The only issue I foresee is that recipe tracking in vanilla and/or other mods might have weird responses if I don't add manual compatibility, but that's a lesser concern at the moment.

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.