Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 2, 2023

Conversation

edayot
Copy link
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).

@RitikShah
Copy link
Collaborator

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
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.

@RitikShah
Copy link
Collaborator

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

Copy link

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
Collaborator

Choose a reason for hiding this comment

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

Very clean!

@RitikShah RitikShah merged commit b5f9cd0 into Smithed-MC:main Nov 2, 2023
1 check passed
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