Skip to content

feat: add beet.contrib.mod_export - #458

Open
jacobsjo wants to merge 2 commits into
mcbeet:mainfrom
jacobsjo:mod_export
Open

feat: add beet.contrib.mod_export#458
jacobsjo wants to merge 2 commits into
mcbeet:mainfrom
jacobsjo:mod_export

Conversation

@jacobsjo

@jacobsjo jacobsjo commented Dec 17, 2024

Copy link
Copy Markdown

This adds a plugin to bundle a data pack and resource pack into a single .jar file, including mod identifier files for fabric, neoforge, mcforge, and quilt.

example config:

pipeline:
- beet.contrib.mod_export
meta:
  mod_export:
    fabric: true
    quilt: true
    neoforge: true
    mcforge: true
    name: '{{project_id}}_{{project_version}}' # filename of resulting .jar file without extension
    group: dev.mcbeet # only used by quilt, but then required

    # these are 2 fields since every loader has a different format to specify format ranges
    # if unspecified uses version specified in beet config
    min_minecraft_version: 1.21.4
    max_minecraft_version: 1.21.5

    license: MIT
    contact:
      # any field is allowed here, but only homepage and issues is used for [mc|neo]forge
      homepage: https://mcbeet.dev/
      issues: https://github.com/mcbeet/beet/issues
    authors: # overwriting author from beet config to allow multiple authors listed separately
    - A
    - B
    contributors:
    - C

Things left to do:

  • Deal with files that are in both resource and data pack (i.e. pack.mcmeta and pack.png, but also other extra files such as a README)
    • Currently this prints warnings, and is actually resulting in duplicate files in the jar archive; probably leading to hard to debug issues with different tools using different files for the same filename
    • I think this would require changes to core, so I would need some help here.
  • Deal with (resource pack) overlays
    • Since there is only one pack.mcmeta, it is unclear how this can work
    • I think fabric uses data-pack version numbers to select resource pack overlays, might be difficult to handle properly
    • I don't know how other loaders handle overlays, if at all

I've written this first for my own datapack at https://github.com/jacobsjo/lavaflow/blob/main/src/modded.py ; for the avoidance of doubt: I own full copyright of this file and am re-licensing this file under MIT

@misode misode changed the title add beet.contrib.mod_export feat: add beet.contrib.mod_export Jan 21, 2025

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

I understand this PR is a bit aged though I'm hoping to get our PRs wrangled now that Summit is over .



def forge(
extra: Dict[str, PackFile], ctx: Context, opts: ModExportOptions, isNeo: bool

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.

for our naming conventions, this should be

Suggested change
extra: Dict[str, PackFile], ctx: Context, opts: ModExportOptions, isNeo: bool
extra: Dict[str, PackFile], ctx: Context, opts: ModExportOptions, is_neo: bool

raise RuntimeError("no output directory set")

ctx.output_directory.mkdir(parents=True, exist_ok=True)
with ZipFile(

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 wonder if we should be re-using beet.contrib.output machinery here and define mod definition files as extra files within the data / resource pack.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If I remember correctly, the point here was to allow export as a mod, while not including these files in the datapack export


@configurable(validator=ModExportOptions)
def mod_export(ctx: Context, opts: ModExportOptions):
extra: Dict[str, PackFile] = dict()

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.

use modern typing now that we are 3.14+

@jacobsjo

jacobsjo commented Sep 1, 2026

Copy link
Copy Markdown
Author

Sorry, but you gotta make the changes yourself if you want to merge this. I'm not gonna get to this any time soon.

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.

2 participants