Add getResultStacks/getAuxiliaryStacks to IRecipeHandler (#1105) (#1131)

Co-authored-by: slprime <[email protected]>
This commit is contained in:
boubou19andslprime authored and GitHub committed 2026-11-19 07:42:56 +01:00
1 parent dc35985ea0
commit 1aa4d56100
17 files changed
+277 -216

No files matched your search

@@ -4,6 +4,7 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@@ -176,6 +177,16 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
return null;
}
/**
* Read only when {@link #getResult()} is {@code null} and {@link #getOtherStacks()} returns the results, see
* {@link IRecipeHandler#getAuxiliaryStacks(int)}.
*
* @return The fuel or catalysts of a recipe with several results.
*/
public List<PositionedStack> getAuxiliaries() {
return Collections.emptyList();
}
@Deprecated
public List<PositionedStack> getCycledIngredients(int cycle, List<PositionedStack> ingredients) {
return ingredients;
@@ -641,6 +652,16 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
return arecipes.get(recipe).getOtherStacks();
}
@Override
public List<PositionedStack> getAuxiliaryStacks(int recipe) {
// goes through the handler methods, subclasses may override them instead of the cached recipe ones
if (getResultStack(recipe) != null) {
return getOtherStacks(recipe);
}
return arecipes.get(recipe).getAuxiliaries();
}
public void onUpdate() {
cycleticks++;
}