Just Enough Calculation

Just Enough Calculation

11M Downloads

Suggestions wanted: the implementation of auto recipe detect

Towdium opened this issue ยท 14 comments

commented

Hey guys, I'm planning to make it possible to search and detect recipes automatically. However, this may cause some problems as well. There are some situations:

  1. There is only one recipe for an item in JEI
  2. There are several recipes for an item in JEI
  3. There are several recipes for an item but is not recorded in JEI

For the first situation, it is very to do and for the third situation, there is nothing I can do. The point is the second case. If I choose to pick the first item provided by JEI, there might be some unexpected results. The problem is I will never know the preference of every user, so it's hard to choose what to do.

So is there any suggestions about the implementation? If I finally get it done, should it be enabled by default? If it's enabled by default, tons of unexpected results will show up, if it's disabled by default, I think there will be only few people to check the configure and it might be kind of buggy since it can not be widely tested.

Any suggestion is welcomed.

commented

There's also a problem even in the simplest/first implementation in that some references will be circular. If I have an iron block and iron ingots, they both provide recipes for one another and nothing else (in vanilla... I believe). This can be avoided by using a breadth-first instead of a depth-first search on the recipes, but even then, you could get some weird things like inconsistent "base materials" or just odd ones (eg I get recipes in terms of nineths of iron blocks instead of number of iron ingots).

Honestly, I think the best approach would just be to load up a config with some reasonable defaults and allow them to be overridden by modpack creators and users. The system you have in place right now is already so flexible, that's why I use it over other options.

commented

@emanb29 Thanks for suggesting. Don't worry about the circulation things, it has been blocked in algorithm. The calculation procedure will stop when it detects circulation or have no recipe available. But that's true, if I load all the recipes, it can be expected to see all the results related to iron ingots will be given in iron blocks XD.

commented

@bookerthegeek Well, that sounds like a good idea! Maybe I should check if there are performance problems.

commented

You could compute the cost of all recipies for an item, then give min/max on it?

commented

@Towdium Could there be a way to store the recipes/groups currently saved in the calculator externally? What I mean is, as a pack maker I am willing to go through and save recipes from my pack manually if
I could share/save them for everyone that is playing the pack. I tried looking for where it saves the groups per person but my guess is it's linked to the uuid of a person since giving the calculator to another player the recipes were not inside. Having some sort of config file that gets created could be really nice to share the functionality for now at least with everyone :) Let me know though if this could be possible!

commented

@TwitchtvCarbs Of course it's possible! Maybe I can do it as a command? Like '\jeca export' or '\jeca store', then the users can get the stored recipes as default. The records are only NBTTags encoded into files, nothing too complex.

commented

Personally, i would prefer it set up similar to how crafttweaker does it, syncing it upon server join event.

commented

@Towdium I think either way it would be great! My community likes the idea of the calc but it can be a little daunting putting in recipes, so to be able to preload them in the pack it would be huge and would be easy to just grab a block and use the calc you know? Love this mod but its a little tough to figure out sometimes for new users to quickly pick up, but it's extremely useful when you get things set up.

edit: I agree with @bookerthegeek it would be quite nice to be able to preload them when the player joins the game somehow. Again being able to preload them all in might take some time but I know people will appreciate it in mod packs for sure. Automatically would be amazing but as stated above it would be a challenge for sure with different recipes.

commented

@TwitchtvCarbs The syncing things are not that tough, in current framework, user data should be already stored at server side, then synced on join server. Don't think anyone can notice the time when loading, they are asynchornized. Furthermore, maybe I can do it like texture packs, then you can easily copy and share, or sync with server.

commented

@Towdium That sounds great! Everyone is blown away when I use the calc... but then I get the question wait how do I get it to show the recipes a lot XD So yeah would be amazing being able to take the time and put them in for everyone to enjoy. Granted its gonna take a while to do but at least it could be done you know?

commented

@TwitchtvCarbs Will give it a try when I have all my exams are done.

commented

@bookerthegeek Yep, should be like that.

commented

@Towdium Awesome! Thanks for being so responcive too! :D Really appricate that :)

commented

In 1.12 version, user can import/export records, and modpack makers are allowed to set default records for new players. I guess that should make it easier for sharing without causing much complexity