# zero-raltal/mcbe-mcworld-mcstructure architecture

> Architecture diagram of the GitHub repository zero-raltal/mcbe-mcworld-mcstructure, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zero-raltal/mcbe-mcworld-mcstructure
- Repository: https://github.com/zero-raltal/mcbe-mcworld-mcstructure

## Overview

minecraft-bedrock-codec is a Node.js/browser toolkit for reading and writing Bedrock `.mcworld` worlds and `.mcstructure` files. Its main user workflow is choosing a read or write example, then using the shared `examples/utils.js` codec helpers; documented format capabilities include NBT, LevelDB/SSTable, SubChunk, BlockEntity, and bidirectional conversion. The README shows sample calls and format coverage, but no source excerpts were provided, so internal helper-to-helper relationships are not inferred.

Main entry points: [`examples/read-mcworld.js`](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/read-mcworld.js) (Read world example), [`examples/utils.js`](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js) (mcworld conversion), [`examples/write-mcworld.js`](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/write-mcworld.js) (Write world example), [`examples/read-mcstructure.js`](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/read-mcstructure.js) (Read structure example)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User workflows"]
  node_read_world["Read world example<br/>[read-mcworld.js]"]
  node_write_world["Write world example<br/>[write-mcworld.js]"]
  node_read_structure["Read structure example"]
  node_write_structure["Write structure example"]
end

subgraph group_codec["Binary codecs"]
  node_nbt["NBT reader/writer<br/>[utils.js]"]
  node_primitives["Binary primitives<br/>[utils.js]"]
end

subgraph group_formats["Bedrock formats"]
  node_leveldb["LevelDB parsing<br/>[utils.js]"]
  node_sstable["SSTable codec<br/>[utils.js]"]
  node_subchunk["SubChunk codec<br/>[utils.js]"]
  node_blockentity["BlockEntity parsing<br/>[utils.js]"]
  node_leveldat["level.dat handling<br/>[utils.js]"]
  node_structure["mcstructure codec<br/>[utils.js]"]
  node_world["mcworld conversion<br/>[utils.js]"]
end

subgraph group_archive["Archive handling"]
  node_jszip["JSZip"]
  node_pako["pako fallback"]
end

node_user(("Toolkit user"))

node_user -->|"runs"| node_read_world
node_user -->|"runs"| node_write_world
node_user -->|"runs"| node_read_structure
node_user -->|"runs"| node_write_structure
node_read_world -->|"loads ZIP"| node_jszip
node_read_world -->|"parses tables"| node_sstable
node_read_world -->|"parses entities"| node_blockentity
node_read_structure -->|"reads format"| node_structure
node_write_structure -->|"serializes NBT"| node_nbt
node_write_world -.->|"writes format"| node_world
node_world -.->|"converts both ways"| node_structure
node_sstable -.->|"uses primitives"| node_primitives
node_leveldb -.->|"includes tables"| node_sstable
node_subchunk -.->|"stores block data"| node_world
node_nbt -.->|"encodes format"| node_structure
node_pako -.->|"zlib fallback"| node_world

click node_read_world "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/read-mcworld.js"
click node_write_world "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/write-mcworld.js"
click node_read_structure "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/read-mcstructure.js"
click node_write_structure "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/write-mcstructure.js"
click node_nbt "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_primitives "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_leveldb "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_sstable "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_subchunk "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_blockentity "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_leveldat "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_structure "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"
click node_world "https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_read_world,node_write_world,node_read_structure,node_write_structure,node_user toneBlue
class node_nbt,node_primitives toneAmber
class node_leveldb,node_sstable,node_subchunk,node_blockentity,node_leveldat,node_structure,node_world toneMint
class node_jszip,node_pako toneRose
```

## Components

### User workflows

- [Read world example](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/read-mcworld.js): `examples/read-mcworld.js`
- [Write world example](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/write-mcworld.js): `examples/write-mcworld.js`
- [Read structure example](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/read-mcstructure.js): `examples/read-mcstructure.js`
- [Write structure example](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/write-mcstructure.js): `examples/write-mcstructure.js`

### Binary codecs

- [NBT reader/writer](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`
- [Binary primitives](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`

### Bedrock formats

- [LevelDB parsing](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`
- [SSTable codec](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`
- [SubChunk codec](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`
- [BlockEntity parsing](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`
- [level.dat handling](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`
- [mcstructure codec](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`
- [mcworld conversion](https://github.com/zero-raltal/mcbe-mcworld-mcstructure/blob/main/examples/utils.js): `examples/utils.js`

### Archive handling

- **JSZip**
- **pako fallback**

### Other components

- **Toolkit user**

## Connections

- Toolkit user → Read world example: runs (evidence: `README.md`)
- Toolkit user → Write world example: runs (evidence: `README.md`)
- Toolkit user → Read structure example: runs (evidence: `README.md`)
- Toolkit user → Write structure example: runs (evidence: `README.md`)
- Read world example → JSZip: loads ZIP (evidence: `README.md`)
- Read world example → SSTable codec: parses tables (evidence: `README.md`)
- Read world example → BlockEntity parsing: parses entities (evidence: `README.md`)
- Read structure example → mcstructure codec: reads format (evidence: `README.md`)
- Write structure example → NBT reader/writer: serializes NBT (evidence: `README.md`)
- Write world example → mcworld conversion: writes format
- mcworld conversion → mcstructure codec: converts both ways
- SSTable codec → Binary primitives: uses primitives
- LevelDB parsing → SSTable codec: includes tables
- SubChunk codec → mcworld conversion: stores block data
- NBT reader/writer → mcstructure codec: encodes format
- pako fallback → mcworld conversion: zlib fallback
