Open MauveCloud opened 4 years ago
Wow that is a lot of work! I hope this get some attention... Out of curiosity, why did you implement such a complex JSON reader? Wouldn't something like this worked the same?
@glowredman
Out of curiosity, why did you implement such a complex JSON reader? Wouldn't something like this worked the same?
Don’t break backwards compat, EVER.
GT_Recipes.GT_Recipe_Map.X cannot be refactored to GT_Recipes.X. This will essentially break every addon ever made alone.
Please don’t EVER rename classes or change function descriptions/args or names.
Harsh. I can refactor things back to hopefully deal with the backwards compatibility, after I take a break to try to calm down.
Are there other addons besides GT++ I need to worry about?
Several of those mods are still in active development. https://github.com/Blood-Asp/GT5-Unofficial/blob/77a3c956e510b7c8ef4654054bcb16a0fccb86f7/src/main/java/gregtech/api/GregTech_API.java#L71
Backwards compatibility will always take precedence on PRs, being so late into 1.7.10s lifespan. We cannot assume any addon will be updated past the next release, so it’s on us to make sure we don’t break things. (That’s just good programming ethics anyway, it’s not harsh. Blood was responsible for breaking the API several times between 5.07.07 and 5.09.15~, it’s a real fucking pain in the ass to support addFurnaceRecipe with three different functions depending on version. 🤷🏻♀️)
That’s just good programming ethics anyway
😕 That's a good point, and shame on me for not considering that better before I started. Fortunately, I was careful to leave the original GT_Recipe.java file alone to be on the safe side, so I think I can salvage the JSON reading code to return a list of that instead (and revert the machine classes I had changed, so they go back to using it instead of the new recipe classes). Unfortunately, I think doing so will prevent addressing the complaint from @leagris about "so many NEI pages displaying recipes of same output but many different item alternatives."
From what little code I can actually review, most of it seems rather straight forward to adjust.
As for Leagris’ issue, I don’t think that’s quite relevant for this PR though at all? Easier to do 20 small PRs than one big convoluted pile that’s impossible to test. Plus keeps things more readable, cause 100+ files changed for this seems a lil absurd. Totally can’t review this on mobile :p
I regret that you have to abandon ore dictionary and alternative stacks ingredients in recipes because of backward compatibility, really. I had hope the old recipe interfaces would persist, but new interfaces would support lists of ingredients definitions.
@leagris I haven't so much abandoned it as deferred it to a future PR. I have already thought of a way I could handle that which shouldn't break backward compatibility. There is already a class "GT_Recipe_WithAlt" (currenly only used for assembly line recipes), so I could probably improve it (maybe in a subclass) to also check inputs against those alts.
Okay, I've finished my own testing, though there's still a chance I missed something or introduced a new issue while fixing what I found from testing, so I'd still prefer if somebody else could check it as well (though I realize it's a big PR and could take some time).
I actually discovered some minor issues with the current code while testing:
I haven't seen any indication of anyone else testing this, and there's more that can be done in future PRs to expand on this, but my part is basically done, so I've removed the "WIP" prefix from the title of the PR.
Originally somewhat inspired by Ender IO's recipe system, this will:
1. Allow more flexible recipe inputs, with some allowing ore dictionary entries or even alternative options that don't share an ore dictionary entry.At Techlone's suggestion, these recipes are specified in JSON instead of XML. Defininite remaining tasks: [ ] Get some help with testing from other users (always better to have at least one person besides the developer do some testing)
Look through the other methods in GT_MachineRecipeLoader and the "oreprocessing" classes for more recipes that can be transferred to json (recipes that run per material and just check for subtags are probably best left there, but there are some that check for specific oredicts)Uncertain remaining tasks (i.e. I'm uncertain these are worth the effort):Come up with a way to handle some of the more complicated recipe handling in GT_MachineRecipeLoader via json, such as recipes currently added with GT_ModHandler instead of GT_Values.RA, which may mean the recipes are added to machines of other mods as well if loaded.[x] Revert machines etc. to original recipe system. [x] Change json reading code to return a list of GT_Recipe.