tModLoader Recursive Craft

Gaelyte

Terrarian
Recursive Craft is a mod that aims to make craft easier by getting rid of all the intermediate recipes and handling them by itself, so you can finally create a bunch of campfires without having to calculate the amount of torches needed, keep all the wood you want as platforms without needing to craft it back to normal wood to craft things or keep the ores unmelted until using them.
This mod also handles the modded recipes and if there is too many recipes available, you can decrease this amount by using the keybinds related to the crafting depth.

The mod is available on the mod browser and on GitHub, along its code and changelog

Note that there is a rare known issue, notably found on Calamity due to its blood orb used in all the alchemy crafts, some recipes might not be shown because of that or even produce a bug on Magic Storage - Extra :
- On the regular crafting menu, it's simply solved by crafting the intermediate recipe by hand
- On the Magic Storage interface, if no ingredient is shown and the menu to craft more items shows "max (0)", don't try to craft the item with the interface, craft the intermediate first and remove the blood orbs from the storage or pick the ingredients from the storage to do the craft by hand
 
Nice concept! Can you show off screenshots of it working, please? I'm having a tough time visualizing it without loading it up. I like to see it before I download. I'll bet I'm not alone in that idea too.
 
I did a screenshot to show the effect, but as there are no fancy UI or anything, and my world is a mess...
But here's a screenshot of a Terra blade only using the base ingredient
1625096518961.png
 
Oh my god. This is amazing. What kind of crafting stations do you need?
Only the ones used in the main recipe and the intermediates
(So for the Terra blade, it's a mythril anvil, an adamantite furnace and an altar, I used a modded crafting station that is counted as every crafting station to go faster for the screen)
 
I removed it
This removal seems to cause an issue with Recipe Browser when this limit is pushed, but this limit will be removed for 1.4 anyway so I don't really want to work on that
Not really, you injected IL to have the FindRecipes vanilla method run through and account for your custom data, still, very clever and well done.
I need to stop thinking there's anything really hardcoded here, there's always a way around it, just sometimes it's not worth the trouble.

Regardless I think alot of people are going to appreciate a mod like this. :thumpsup:
 
Not really, you injected IL to have the FindRecipes vanilla method run through and account for your custom data, still, very clever and well done.
I need to stop thinking there's anything really hardcoded here, there's always a way around it, just sometimes it's not worth the trouble.

Regardless I think alot of people are going to appreciate a mod like this. :thumpsup:
? My only IL injection I do is to replace the vanilla recipe search by mine
 
? My only IL injection I do is to replace the vanilla recipe search by mine
I originally thought you did something like altering the Recipe maxRequirements fields before recipes were added or manually putting them into recipes/resizing the arrays.
It took me a moment to realize what your injection really did. I can see how this would cause Recipe browser to question what's going on.

Fascinating thou, thanks for sharing your code, I am always eager to learn how people do things.
only question is:
shouldn't the part at the start of PostAddRecipes
if (type == ItemID.None) break;
use (continue) instead of (break)?

break stop the whole loop, continue skips the current iteration
 
I originally thought you did something like altering the Recipe maxRequirements fields before recipes were added or manually putting them into recipes/resizing the arrays.
It took me a moment to realize what your injection really did. I can see how this would cause Recipe browser to question what's going on.

Fascinating thou, thanks for sharing your code, I am always eager to learn how people do things.
only question is:
shouldn't the part at the start of PostAddRecipes
if (type == ItemID.None) break;
use (continue) instead of (break)?

break stop the whole loop, continue skips the current iteration
Recipes always have their ingredients first and because of the fixed size of the ingredient array, the rest is just ItemID.None... So this check allows to go quicker on a Recipe ingredient loop...
This is what also avoid the crash of vanilla because in vanilla, there's the same break on ItemID.None and there must be at least one at the end of the array, preventing the crash because the array isn't big enough
That's also whats make Recipe Browser break weird, because the same thing should avoid any problem on a maxRequirement change
 
Ohh right, I tend to use 0 instead of the ID values for 0. I'm going to assume that any recipe that has no createItem/is blank is the end of the check anyways.
But I wasn't talking about the 2nd loop, I meant the 1st loop before it, where you check recipe createItem
 
Ohh right, I tend to use 0 instead of the ID values for 0. I'm going to assume that any recipe that has no createItem/is blank is the end of the check anyways.
But I wasn't talking about the 2nd loop, I meant the 1st loop before it, where you check recipe createItem
Well generally, when you hit ItemID.None, there's nothing interesting after that
 
This is an amazing little mod and would recommend to have for any playthrough, its a huge QoL mod and would recommend! Great work love the mod.
 
Hey Gaelyte, I really like your mod! Although, there's been a bug with the tinkerer's workshop and this mod where the game freezes/crashes whenever I place it on the ground/magic storage crafting system. Turning down the recursive depth improve this somehow, but I had to disable the mod for now because the game would freeze for 2-3 seconds whenever I opened my storage system.

Not sure if this happens with any of the other crafting stations, but it doesn't with the basic ones. Just wanted to let you know!
 
Hey Gaelyte, I really like your mod! Although, there's been a bug with the tinkerer's workshop and this mod where the game freezes/crashes whenever I place it on the ground/magic storage crafting system. Turning down the recursive depth improve this somehow, but I had to disable the mod for now because the game would freeze for 2-3 seconds whenever I opened my storage system.

Not sure if this happens with any of the other crafting stations, but it doesn't with the basic ones. Just wanted to let you know!
Well, are you using tmod 64 bits to use many mods ?
Because of the way Terraria is coded, my mod doesn't handle well tons of recipes.
 
Last edited:
I may have found the culprit for the Tinkerer's Workshop problems, and it might be due to imksushi's mod, since not only does that mod ad in 1,250 new recipes, but most of those are directly related to the tinkerer's workshop, more specifically, to loot swapping. Most boss drops can be crafted into a different drop from the same boss with the Tinkerer's Workshop in imksushi's mod, and this leads to massive recipe bloat as every drop needs to be craftabe into every other drop from that boss (which includes modded ones I believe too)

I overall love this mod, but yah, it slows to a crawl when you try to use it with imksushi's mod and have a Tinkerer's Workshop in your Magic Storage+ crafting interface (for me anyway). I've had to remove imksushi's mod from my mod list as a result, might help go beyond too if he has it, since between the two, I'd rather keep Recursive Craft :)

Could there be a way that we can blacklist certain recipes from certain mods? Would be nice to have a way to, let's say blacklist all imksushi's mod recipes that are tied to the Tinkerer's Workshop :D
 
I'm also having the same issue with the Tinkerer's Workshop, but I think I found a slight workaround? I've only played around with it a bit, but it looks like reverting imksushi's mod to using the old recipes by installing the "imksushi's mod - old recipes enabler" mod removes the lag with the tinkerer's workshop and magic storage crafting. Not a total solution, but I'm greedy and I want all the mods! >:D
 
I'm also having the same issue with the Tinkerer's Workshop, but I think I found a slight workaround? I've only played around with it a bit, but it looks like reverting imksushi's mod to using the old recipes by installing the "imksushi's mod - old recipes enabler" mod removes the lag with the tinkerer's workshop and magic storage crafting. Not a total solution, but I'm greedy and I want all the mods! >:D
I'm only working on the 1.4 version now as it enables a better way to compute the recipes.
I hope I will be able to make a more optimized version on it
 
Back
Top Bottom