Skip to content

feat: adding beet.contrib.snapshot#502

Open
edayot wants to merge 15 commits into
mcbeet:mainfrom
edayot:runtime_minecraft_version
Open

feat: adding beet.contrib.snapshot#502
edayot wants to merge 15 commits into
mcbeet:mainfrom
edayot:runtime_minecraft_version

Conversation

@edayot

@edayot edayot commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

Theses PR implement the plugin that adds at require time a new minecraft version, it uses misode/mcmeta repo as a default source but it can be customized.

This PR also comes with a fix for 1.21.x syntax handling in mecha, and adds the ability to resolve a minecraft version by calling a function to resolve a specific minecraft_version if necessary.

@edayot edayot marked this pull request as ready for review March 1, 2026 17:03
@Stoupy51

Copy link
Copy Markdown

Hello?

@misode

misode commented Apr 25, 2026

Copy link
Copy Markdown
Member

@Stoupy51 Please don't spam comments on PR's

@Stoupy51

Stoupy51 commented Apr 25, 2026

Copy link
Copy Markdown

@Stoupy51 Please don't spam comments on PR's

Sorry, that wasn't my intention
It's just a bit frustrating to see PRs remain inactive for a long time when there's nothing I can contribute from my side

@rx-dev rx-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

couple of thoughts but i think it would be chill

resolved = search_version(version)
try:
version = split_version(resolved)
except ValueError:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is the best way to determine whether we can use a specific version to chk for a ValueError, this feels wrong to me. esp since LATEST_MINECRAFT_VERSION is also the default here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i see, this was sorta how it was previously done...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't really know how to do better, because if someone wants to develop in old snapshot schema, the split_version function raise a ValueError

Should i delete this try catch block or keep it that way ?

"""URL template to download the version manifest from. The {version} placeholder will be replaced with the Minecraft version."""

url_command_tree: str = "https://raw.githubusercontent.com/misode/mcmeta/refs/tags/{version}-summary/commands/data.json"
"""URL template to download the command tree from. The {version} placeholder will be replaced with the Minecraft version."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@misode do u think it's a good idea to encode the misode/mcmeta links as constants here? i don't see anything wrong with it, curious if u think it's a bad idea (maybe fine for contrib).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems fine in this case. The alternative would be to run the data generator in beet and cache it in beet_cahce but that's obviously a lot more involved. Maybe could consider adding adding a few backup urls (like the spyglass api, or Ersatz' mcdata repo) if you don't want to rely on mcmeta specifically.

Comment thread src/beet/contrib/snapshot.py Outdated
ResourcePack.pack_format_registry.add_format(pack_format)

path = cache.download(opts.url_command_tree.format(version=ctx.minecraft_version))
ctx.meta.setdefault("mecha", {}).setdefault("commands", []).insert(0, path)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm, i wonder if the best way for the contrib to enact the new tree is by setting it via the config. shouldn't it like just require a plugin or something? this feels odd to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was doing it that way, because if someone adds a custom command tree, i don't want to interfer with it and all instances of the Mecha class can use it by default.

I based this implementation on this example by Fizzy on discord : https://discord.com/channels/900530660677156924/1407893565601742909/1408164150336815184

Comment thread src/beet/resources/pack_format_registry.py Outdated
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.

5 participants