Skip to content

Commit

Permalink
Skip calling getRecipesForInput and getRecipesForOutput on ISimpleRec…
Browse files Browse the repository at this point in the history
…ipeManagerPlugin that do not handle the stack
  • Loading branch information
mezz committed Sep 2, 2024
1 parent bf7394d commit df2adf8
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ private boolean isHandled(IFocus<?> focus) {

@Override
public <T2, V> List<T2> getRecipes(IRecipeCategory<T2> recipeCategory, IFocus<V> focus) {
if (recipeCategory.getRecipeType().equals(recipeType)) {
if (recipeCategory.getRecipeType().equals(recipeType) &&
isHandled(focus)
) {
List<T> recipes = getRecipes(focus);
@SuppressWarnings("unchecked")
List<T2> castRecipes = (List<T2>) recipes;
Expand All @@ -71,6 +73,9 @@ public <T2, V> List<T2> getRecipes(IRecipeCategory<T2> recipeCategory, IFocus<V>
}

private List<T> getRecipes(IFocus<?> focus) {
if (!isHandled(focus)) {
return List.of();
}
switch (focus.getRole()) {
case INPUT -> {
List<T> recipesForInput = plugin.getRecipesForInput(focus.getTypedValue());
Expand Down

0 comments on commit df2adf8

Please sign in to comment.