Skip to content

chore(crafter): Get #smithed.crafter:all from misode/mcmeta#37

Merged
rx-dev merged 2 commits intoSmithed-MC:mainfrom
edayot:cache-item-list
Nov 2, 2023
Merged

chore(crafter): Get #smithed.crafter:all from misode/mcmeta#37
rx-dev merged 2 commits intoSmithed-MC:mainfrom
edayot:cache-item-list

Conversation

@edayot
Copy link
Copy Markdown
Contributor

@edayot edayot commented Nov 1, 2023

Get the item list from "https://raw.githubusercontent.com/misode/mcmeta/{version}-registries/item/data.json" (where version is the ctx.minecraft_version).

@rx-dev
Copy link
Copy Markdown
Collaborator

rx-dev commented Nov 1, 2023

This is a clean idea, thanks for writing this up. I'll want to use the Vanilla class from beet.contrib.vanilla for this but the idea is good 👍🏿

@edayot
Copy link
Copy Markdown
Contributor Author

edayot commented Nov 1, 2023

Because the information is in the registries and not in the data folder, I haven't found a way with beet to extract the list.

@rx-dev
Copy link
Copy Markdown
Collaborator

rx-dev commented Nov 2, 2023

Ah, this makes sense then. I think this will be a good solution.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using beet's cache.download() method

def beet_default(ctx: Context):
    cache = ctx.cache["smithed_crafter"]

    all_items_url = f"https://raw.githubusercontent.com/misode/mcmeta/{ctx.minecraft_version}-registries/item/data.json"
    all_items = ItemTag(source_path=cache.download(all_items_url))
    all_items.data = {"values": all_items.data}

    ctx.generate("smithed.crafter:all", all_items)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean!

@rx-dev rx-dev merged commit b5f9cd0 into Smithed-MC:main Nov 2, 2023
github-actions Bot pushed a commit that referenced this pull request Nov 2, 2023
…eta (#37)

* get item list from misode/mcmeta
* fix: use updated code from @fizzy

---------

Co-authored-by: RitikShah <ritik10.shah@gmail.com>, vberlier
@edayot edayot deleted the cache-item-list branch November 2, 2023 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants