Architecture Overview
Relevant source files
The following files were used as context for generating this wiki page:
HoloPrint is a web-based application designed to convert Minecraft Bedrock Edition (MCBE) structure files (.mcstructure) into resource packs (.mcpack). These resource packs utilize armor stands and custom geometry to project holograms of building schematics into the game world, aiding players in complex constructions. The application logic is primarily client-side, leveraging JavaScript libraries to parse NBT data, generate textures, and compile zip archives.
Sources: README.md:1-10, src/HoloPrint.js:46-60
Core System Components
The architecture is divided into three primary layers: the User Interface (Frontend), the Pack Generation Engine, and the 3D Preview System.
1. Frontend & Input Handling
The frontend is built using standard HTML5 and vanilla JavaScript, utilizing a form-based interface to collect user configurations and files. It supports multiple input methods, including direct .mcstructure uploads, world file extraction (.mcworld or .zip), and updating existing HoloPrint packs.
Key responsibilities include:
- File Orchestration: Managing file buffers and passing them to the NBT reader.
- Configuration Management: Normalizing user inputs (scale, opacity, controls) into a
HoloPrintConfigobject. - Translation Engine: Dynamic localization using JSON-based translation files.
Sources: src/index.html:100-250, src/index.js:50-150
2. Pack Generation Engine (HoloPrint.js)
This is the central logic module that orchestrates the conversion process. It processes raw NBT data into Minecraft-compatible resource pack components.
The flow represents the transformation of a static structure file into a dynamic Minecraft resource pack.
Sources: src/HoloPrint.js:63-110
3. Preview Rendering System (PreviewRenderer.js)
The system provides a real-time 3D visualization of the structure using Three.js before the user downloads the pack. It replicates Minecraft's rendering style, including ambient lighting and directional shading.
Sources: src/PreviewRenderer.js:15-50
Data Processing Pipeline
The conversion pipeline follows a strictly defined sequence to ensure that the resulting resource pack is optimized for the Minecraft Bedrock engine.
Block Palette and NBT Parsing
The system reads the .mcstructure file as an NBT compound. It identifies all unique blocks and their states. The tweakBlockPalette function handles:
- Version Updating: Updating old block identifiers to current Bedrock standards.
- Entity Extraction: Converting block entities (like chests or signs) into separate entries if they require custom rendering.
- Filtering: Removing ignored blocks (e.g., air, light blocks) to reduce the geometry footprint.
Sources: src/HoloPrint.js:513-560
Geometry and Texture Mapping
Minecraft Bedrock resource packs use JSON-based geometry. HoloPrint generates poly_mesh objects for each layer of the structure.
- BlockGeoMaker: Determines the shape of each block based on its state.
- TextureAtlas: Combines individual block textures into a single atlas to minimize draw calls.
- UV Mapping: Maps the generated geometry vertices to the specific coordinates in the new texture atlas.
Sources: src/HoloPrint.js:175-210, src/HoloPrint.js:630-650
Component Interactions
The following sequence diagram illustrates the lifecycle of a pack generation request from the UI to the final file delivery.
This diagram shows the asynchronous flow of data between the UI, the core engine, and the rendering components.
Sources: src/index.js:460-520, src/HoloPrint.js:63-300
Technical Specifications & Configuration
The HoloPrintConfig object defines the behavior of the generation engine.
| Parameter | Type | Default | Description |
|---|---|---|---|
SCALE | number | 0.95 | The scale of the "ghost" blocks in the hologram. |
OPACITY | number | 0.9 | Transparency level for the hologram. |
SPAWN_ANIMATION | boolean | true | Enables/disables the animation when placing the hologram. |
TINT_COLOR | string | "#579EFA" | Hex color overlay for the hologram. |
BACKUP_SLOT_COUNT | number | 10 | Number of save states stored in the pack. |
Sources: src/HoloPrint.js:440-480
Output Pack Structure
The resulting .mcpack is a standard ZIP archive containing the following directory structure derived from the packTemplate:
manifest.json: Contains the pack UUID and versioning.entity/: Contains thearmor_stand.entity.jsonwhich is patched to include the hologram logic.models/entity/: The generated.geo.jsonfiles containing the structure geometry.textures/holoprint/: The generated texture atlas and control icons.render_controllers/: Logic for when and how the hologram renders.texts/:.langfiles for multi-language support.
Sources: src/packTemplate/manifest.json:1-40, src/HoloPrint.js:330-380
Conclusion
The HoloPrint architecture effectively decouples UI-heavy operations (file picking, configuration) from intensive data processing (NBT parsing, mesh generation). By utilizing a template-based approach for the Minecraft resource pack files and dynamically injecting generated geometry and textures, it provides a scalable way to handle large Minecraft structures within a web browser environment.