Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

 

  • Author

Like the vanilla IRecipeType? Or IRecipe? Most, if not all, of the vanilla recipes only have exactly one output, so I'm not sure I can use those.

 

I've never done similar things before but by looking at some codes it seems like you will need a recipe that implements IRecipe, an registered IRecipeType which is the place you get the recipes from, and a registered serializer using RegistryEvent.

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

  • Author

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.