aboutsummaryrefslogtreecommitdiff
path: root/internal/action
diff options
context:
space:
mode:
Diffstat (limited to 'internal/action')
-rw-r--r--internal/action/recipe.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/action/recipe.go b/internal/action/recipe.go
index fee3434..d1acaa5 100644
--- a/internal/action/recipe.go
+++ b/internal/action/recipe.go
@@ -75,6 +75,26 @@ func (r *RecipeDef) MatchesEntry(itemID string) bool {
return false
}
+func (s *RecipeStore) FindByInput(recipeType string, itemID string) *RecipeDef {
+ all, err := s.LoadAll()
+ if err != nil {
+ return nil
+ }
+ for i := range all {
+ if recipeType != "" && all[i].Type != recipeType {
+ continue
+ }
+ for _, e := range all[i].Consume {
+ for _, id := range e.Items {
+ if id == itemID {
+ return &all[i]
+ }
+ }
+ }
+ }
+ return nil
+}
+
func (s *RecipeStore) FindByItem(itemID, recipeType string) ([]RecipeDef, error) {
all, err := s.LoadAll()
if err != nil {