diff options
author | Benji Dial <benji6283@gmail.com> | 2023-12-18 05:49:34 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2023-12-18 05:49:34 -0500 |
commit | cab012d443e35b17d55ee55b7bd233d1fc36181f (patch) | |
tree | d54d3f0387224317f5e3358bd18a68f61d22e032 /mc-resources.py | |
parent | 41579ae10a676ee55df095a2512827cd00bf1ec9 (diff) | |
download | mc-resources-cab012d443e35b17d55ee55b7bd233d1fc36181f.tar.gz |
fix recursive tags
Diffstat (limited to 'mc-resources.py')
-rw-r--r-- | mc-resources.py | 11 |
1 files changed, 10 insertions, 1 deletions
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) |