-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recipe loading from json assets #1583
base: unstable
Are you sure you want to change the base?
Conversation
Syncing from original.
Also tweaked an argument name and usage for easier backward compatibility with functions that call the old recipe system.
Also migrated some fluid extractor and mixer recipes to json assets.
Also fixed some temporary issues that appeared during testing.
…lder recipes. Soldering fluids are most notably used in circuit assembler recipes.
If a json recipe is flagged as disabled (or has 0 duration) in the config folder, the colliding recipes from assets will not be added.
Wow that is a lot of work! I hope this get some attention... |
|
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.
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 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.2. Allow recipes that would normally be added by GT_MachineRecipeLoader to be read from assets in the jar.
3. Allow user-specified recipes to be read from the config folder, without needing GTTweaker.
4. Allow recipes with more inputs or outputs than normal for a given machine - these may not show correctly in NEI, but they can still work if the machine is in a Processing Array.
5. Allow other machines to have recipes read without requiring a new function for each (as long as adding the recipe isn't supposed to perform extra steps, like the assembly line for handling the research items, which isn't currently handled)
6. Allow disabling or overriding an individual recipe via config recipes without forcing the new recipe to use a different duration. (at least for most recipes added by GT_MachineRecipeLoader; probably wouldn't work for recipes added in the "oreprocessing" classes)
There may be other advantages I haven't thought of yet.
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.