From cab012d443e35b17d55ee55b7bd233d1fc36181f Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 18 Dec 2023 05:49:34 -0500 Subject: fix recursive tags --- mc-resources.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mc-resources.py') diff --git a/mc-resources.py b/mc-resources.py index 2614980..cf5dc10 100644 --- a/mc-resources.py +++ b/mc-resources.py @@ -98,6 +98,15 @@ def add_recipe(recipe): else: recipe_lists[output] = [recipe] +def recursive_tag_lookup(tag): + list = [] + for id in tag_lists[tag]: + if id[0] == '#': + list += recursive_tag_lookup(id[1:]) + else: + list.append(id) + return list + def ilist_product(ilist): ilist_new = [] for il in ilist: @@ -106,7 +115,7 @@ def ilist_product(ilist): il = [il] for i in il: if 'tag' in i: - il_new += tag_lists[i['tag']] + il_new += recursive_tag_lookup(i['tag']) else: il_new.append(i['item']) ilist_new.append(il_new) -- cgit v1.2.3