stewbeet.plugins.merge_smithed_weld

The merge_smithed_weld plugin merges generated datapacks and resource packs with their dependencies.
It uses Smithed Weld to combine project archives with library dependencies, official libraries,
and custom libraries into unified distribution packages with proper metadata handling,
consistent timestamps, and optimized compression for production deployment.

Some Features Showcase

Output directory will get both datapack and resource pack zipped

We can see inside the datapack all namespaces

Required: Generated base archives from archive plugin
Required: Configured output directory and project name
Optional: Custom libraries in configured libs folder
Optional: Official libraries (automatically detected from usage)
Position: Must run after archive plugin creates base zip files
Source Code: stewbeet/plugins/merge_smithed_weld/__init__.py

Source Code: stewbeet/plugins/merge_smithed_weld/weld.py

Source Code: stewbeet/plugins/merge_smithed_weld/datapack.py

Source Code: stewbeet/plugins/merge_smithed_weld/resource_pack.py

What it does

  • Merges project packs with library dependencies using Smithed Weld
  • Combines custom libraries from configured libs folder
  • Integrates used official libraries automatically
  • Handles proper pack.mcmeta and pack.png preservation
  • Maintains consistent timestamps for reproducible builds
  • Creates distribution-ready merged archives

Configuration

Basic Example Configuration

yaml
# Requires output and project name configuration
output: "build"
name: "My Project"

pipeline:
  - ...
  - stewbeet.plugins.merge_smithed_weld.datapack
  - stewbeet.plugins.merge_smithed_weld.resource_pack

meta:
  stewbeet:
    libs_folder: "libs"  # Optional: custom libraries folder
    libs_exclude_patterns: []  # Optional: library archives to leave out entirely

Leaving a Library Out

libs_exclude_patterns filters the archives found in libs_folder, matched against their path relative to that folder. An excluded archive is invisible to the whole build: it is neither welded nor copied to a destination, so a module can toggle an optional pack from its own config.

yaml
meta:
  stewbeet:
    libs_exclude_patterns: ["resource_pack/*ARAM*.zip"]

Choosing Which Packs Get Merged

Welding is the slowest step of most builds (it re-compresses every library into the output), so prefer the split entry points and list only the pack types you actually ship:

Pipeline entryMerges
stewbeet.plugins.merge_smithed_weld.datapackπŸ“„ Only the datapack
stewbeet.plugins.merge_smithed_weld.resource_pack🎨 Only the resource pack
stewbeet.plugins.merge_smithed_weldπŸ“¦ Both at once (shorthand for listing both of the above)

Listing both split entries is equivalent to the plain one, in any order.

yaml
pipeline:
  - ...
  - stewbeet.plugins.archive
  # Skip the datapack weld during development: copy_to_destination already ships the datapack
  # and every lib zip separately, so the merged datapack is only needed to publish a release.
  - stewbeet.plugins.merge_smithed_weld.resource_pack

⚠️ A pack type nobody welds gets its _with_libs.zip deleted from the output directory.
This is deliberate: a leftover archive from an earlier build would be picked up by compute_sha1 and by a release upload, silently shipping stale content. Switch back to the plain entry (or add the missing one) before publishing a release that bundles both packs.

Configuration Options

OptionTypeDefaultDescription
outputstringRequiredDirectory containing base archives and destination for merged archives
namestringRequiredProject name used for archive naming
libs_folderstring"libs"Folder containing custom library archives (datapack/.zip, resource_pack/.zip)
libs_exclude_patternslist[string][]Glob patterns, relative to libs_folder, of archives to leave out of the build
Archive Namingautomatic{project}_with_libs.zipNaming pattern for merged archive outputs
Pack Type Selectionpipeline entrybothUse the .datapack / .resource_pack entry points to merge only that pack type

Features

Archive Detection System

Automatically detects and validates base archives for merging:

  • πŸ“¦ Looks for project datapack and resource pack archives
  • βœ… Only processes packs when base archives exist
  • 🏷️ Uses sanitized project names for consistent file naming
  • πŸ“ Ensures output directory structure is properly created

Selective Pack Merging

Lets the pipeline pick which pack types are worth the compression cost:

  • 🎯 Prefer the .datapack and .resource_pack entry points, each merging a single pack type
  • πŸ”€ Both can be listed together, in any order, for the same result as the plain entry
  • 🧹 Deletes the _with_libs.zip of any pack type nobody welds, so stale archives never ship
  • πŸ“’ Reports the skipped pack types once, at the end of the build

Smithed Weld Integration

Uses Smithed Weld CLI for professional pack merging:

  • ⚑ Leverages Smithed's battle-tested merging algorithms
  • πŸ›‘οΈ Handles conflict resolution and dependency management
  • πŸ”§ Configures error-only logging for clean output
  • πŸ“Š Creates temporary files for safe processing

Official Library Integration

Automatically includes used official libraries in merged packs:

  • πŸ“š Reads from OFFICIAL_LIBS registry for available libraries
  • βœ… Only includes libraries marked as used in the project
  • πŸ“ Supports separate datapack and resource pack library paths
  • πŸ” Validates library existence before inclusion

Custom Library Support

Integrates custom libraries from configured folders:

  • πŸ“ Scans configured libs_folder for datapack and resource pack archives
  • πŸ” Uses glob patterns to find all zip files in respective folders
  • 🎯 Supports organized library structure with separate pack types
  • βœ… Gracefully handles missing or empty library folders

Metadata Preservation System

Ensures proper pack.mcmeta and pack.png handling:

  • πŸ”„ Excludes conflicting metadata from merged libraries
  • πŸ“ Uses project's original pack.mcmeta for final archive
  • πŸ–ΌοΈ Preserves project's pack.png if available
  • βœ… Ensures proper metadata precedence and consistency

Timestamp and Compression Management

Maintains consistent timestamps and optimal compression:

  • ⏰ Uses get_consistent_timestamp for reproducible builds
  • πŸ—œοΈ Applies ZIP_DEFLATED compression with level 6
  • πŸ“Š Creates proper ZipInfo objects for all entries
  • 🧹 Cleans up temporary files after processing

Next steps