This tool allows you to convert Minecraft .mcstructure files into .glb format for use in Blender and other 3D modeling software. It reads .mcstructure files, extracts block data, and generates a 3D scene using Three.js before exporting it as a .glb file.
- Parses
.mcstructurefiles usingprismarine-nbt. - Converts block structures into a Three.js 3D scene.
- Supports textured blocks by reading Minecraft's model and texture data.
- Exports
.glbfiles usingnode-three-gltf. - Handles air blocks efficiently to optimize scene performance.
- Supports block colorization and material caching for faster processing.
Ensure you have the following installed:
- Node.js (LTS recommended)
- NPM or Yarn
- Clone this repository:
git clone https://github.com/notcacti/mcstructure-to-gltf.git cd mcstructure-to-gltf - Install dependencies:
npm install
Run the command with the input .mcstructure file and desired output .glb file:
node index.js <input.mcstructure> <output.glb>Example:
node index.js house.mcstructure house.glb- Reading File: The
.mcstructurefile is read and parsed usingprismarine-nbt. - Extracting Block Data:
- The structure's size is determined.
- Block indices and palette are extracted.
- Creating the 3D Scene:
- A Three.js scene is initialized.
- Blocks are placed in the scene based on extracted data.
- Textures are loaded from Minecraft's assets.
- Exporting to GLB:
- The final scene is converted into
.glbformat.
- The final scene is converted into
- Block textures are loaded based on Minecraft's model JSON files.
- Textures are colorized if necessary.
- Materials are cached for efficiency.
- Air blocks are ignored during processing to optimize performance.
If you see an error like:
[❌] Missing texture: stone.png
Ensure you have the correct Minecraft assets in the assets/minecraft/textures/ directory.
If you receive:
[❌] Invalid .mcstructure file format.
The input file may be corrupted or not a valid .mcstructure file.
This project is licensed under the MIT License.