-
Notifications
You must be signed in to change notification settings - Fork 176
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
Fixed AbstractRecipeLogic only attempting the first valid recipe. #2372
base: master
Are you sure you want to change the base?
Conversation
… only trying the "first" valid recipe.
I've done some further testing and it appears Multismelter recipes are not working with this change because of an override in FurnaceRecipeMap. Please await another commit to resolve this issue before accepting the PR. |
Electric smelter / multismelter bug fixed. The problem was that the recipe iterator I created was not looking at the vanilla furnace recipes. It was looking at an empty recipe map. fixed in commit: 95cd4c8479e356bf58a569d103d20757b3f6744f |
src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java
Outdated
Show resolved
Hide resolved
This is failing tests right now, which needs to be addressed. |
What
Recipe map only has functions for finding a single recipe. Multiblocks can share recipes, and need a way to find a set of valid recipes given the inputs.
Implementation Details
Created
RecipeIterator
which implementsIterator<Recipe>
. Thenext()
function works as expected although I only madehasNext()
function return true if there are still untraversed nodes of the recipe tree. aka it doesn't guarantee a next potential recipe, just the possibility of one. I'm sure there is a better way to do this but I couldn't think of anything that didn't involve doing the traversal twice. (tbf that might be the best approach)Made some changes to ARL:
trySearchNewRecipe()
now checks all potential recipes (starting with the previous one) until it finds a valid recipe to run or doesn't. in which case it flags the IO as waiting for changes.prepareRecipe() == true
is used to determine if the recipe is valid, if it returns false I just unflag the IO and continue trying possible recipes until one successfully triggers.shouldSearchForRecipes()
used to checkcanWorkWithInputs() && canFitNewOutputs()
this had to be changed tocanWorkWithInputs() || canFitNewOutputs()
since now freeing up space in the output bus/hatch is a condition that should trigger a new recipe search. (this case was not always covered by the original check because ifcanWorkWithInputs()
was false the && would not evaluatecanFitNewOutputs()
.Outcome
Multiblocks of the same type can now share input hatches - while running different recipes - without locking up.
Multiblocks can now be responsible for multiple recipes, after running one recipe until either the corresponding inputs are exhausted or the output buffers fill up, it will check for any other valid recipes and attempt to perform them.
Additional Information
N/a
Potential Compatibility Issues
N/a