Resource Pack Generation Pipeline
Relevant source files
The following files were used as context for generating this wiki page:
The Resource Pack Generation Pipeline is the core engine of HoloPrint, responsible for transforming Minecraft Bedrock Edition (MCBE) .mcstructure files into functional .mcpack resource packs. This pipeline orchestrates the parsing of NBT data, the generation of custom geometry through poly-mesh construction, the creation of texture atlases, and the injection of Molang scripts to enable in-game hologram controls.
The pipeline is primarily driven by the makePack function, which integrates multiple sub-systems including BlockGeoMaker, TextureAtlas, and ResourcePackStack to produce a zipped resource pack that includes custom entity definitions, render controllers, and UI components.
Pipeline Architecture and Flow
The generation process follows a linear sequence from input ingestion to the final assembly of the ZIP archive.
1. Input Ingestion and NBT Parsing
The pipeline begins when the user submits structure files via the web interface. Files can be provided as raw .mcstructure files, extracted from .mcworld backups, or recovered from existing HoloPrint packs.
Sources: src/index.js:195-204, src/HoloPrint.js:68-81
2. Palette Merging and Block Updating
Since multiple structures can be included in a single pack, the pipeline merges individual block palettes into a global palette. During this phase, it also executes a BlockUpdater to ensure legacy block data is compatible with the latest engine versions.
Sources: src/HoloPrint.js:145-155, src/HoloPrint.js:464-508
3. Asset Generation (Geometry and Textures)
The pipeline generates a poly_mesh for each layer of the structure. It also constructs a TextureAtlas by fetching block textures from the ResourcePackStack (which merges vanilla and local assets) and applying user-defined outlines or tints.
Sources: src/HoloPrint.js:160-184, src/HoloPrint.js:199-234
The diagram above shows the high-level data flow from input structure files to the final .mcpack output.
Core Components
makePack Function
The primary orchestrator located in src/HoloPrint.js. It accepts structure files and a configuration object, returning a Promise<File>.
Sources: src/HoloPrint.js:68-356
ResourcePackStack
A utility class that manages asset priority. It allows HoloPrint to fetch textures and JSON definitions from vanilla game data or user-uploaded resource packs, merging files like blocks.json or terrain_texture.json where necessary.
Sources: src/ResourcePackStack.js:11-53
The sequence diagram illustrates how assets are resolved with local pack priority over vanilla data.
Configuration Options
The pipeline behavior is controlled by the HoloPrintConfig object.
| Option | Type | Default | Description |
|---|---|---|---|
SCALE | number | 0.95 | Scale of ghost blocks in the hologram. |
TINT_COLOR | string | "#579EFA" | Hex color used for the hologram overlay. |
SPAWN_ANIMATION_ENABLED | boolean | true | Whether to generate block-by-block spawn animations. |
PLAYER_CONTROLS_ENABLED | boolean | true | Enables item-based interaction with the hologram. |
COORDINATE_LOCK | Vec4[] | undefined | Optional fixed world coordinates for the hologram. |
COMPRESSION_LEVEL | number | 5 | ZIP compression level (0-9). |
Sources: src/HoloPrint.js:419-455
Molang Scripting and Controls
A significant part of the pipeline involves generating Molang scripts that are injected into the armor_stand.entity.json and player render controllers. These scripts handle:
- Layer Switching: Logic for
v.hologram.layerandv.hologram.layer_mode. - Validation: Highlighting incorrect blocks using particle effects (e.g.,
validate_blockname). - Initialization: Setting the initial structure index and rotation.
Sources: src/HoloPrint.js:255-296, src/HoloPrint.js:591-625
Final Assembly
The pipeline uses JSZip (via @zip.js/zip.js) to bundle all generated assets into the standard MCBE folder structure:
manifest.json: Contains UUIDs and metadata.texts/*.lang: Localization files for material lists and control names.models/entity/*.json: The generatedpoly_meshgeometry.textures/holoprint/: Custom texture atlases and icons.
Sources: src/HoloPrint.js:316-353, src/packTemplate/manifest.json:1-35
Implementation Example: Pack Assembly
// src/HoloPrint.js:316-324
const zipWriter = new ZipWriter(packFileWriter);
await Promise.all(Object.entries(packFiles).map(async ([fileName, fileContents]) => {
let options = { level: config.COMPRESSION_LEVEL };
if(fileContents instanceof Blob) {
return zipWriter.add(fileName, new BlobReader(fileContents), options);
}
// ...
}));
Sources: src/HoloPrint.js:316-324
Conclusion
The Resource Pack Generation Pipeline automates the complex task of creating Minecraft Bedrock technical assets. By combining NBT processing with real-time asset generation and Molang injection, it provides a seamless transition from a static structure file to an interactive in-game building guide.