anvil-nbt
A Rust library for parsing and encoding Minecraft's NBT and Anvil (.mca) formats.
Built for world editors, servers, and tools that need reliable access to Minecraft world data.
Features
- High Performance: Manual byte-level parsing for maximum speed (no parser combinator overhead)
- Lazy Loading: Memory-mapped Anvil region files via
memmap2load only the chunks you need - Full NBT Support: Handles all tag types, including Modified UTF-8 (MUTF-8) strings
- Optional Serde Support: Serialize/Deserialize Rust structs directly to/from NBT via the
serdefeature - Bit-Perfect Round-trips: Idempotent parsers and encoders preserve data exactly
- Compression Support: Built-in Gzip and Zlib compression handling via
flate2 - CLI Utility: Includes
mc-inspectfor inspecting world files from the terminal
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
Reading a level.dat (Gzipped NBT)
use parse_named_tag;
use GzDecoder;
use File;
use Read;
Accessing an Anvil Region File
use Region;
Serde Support (Optional)
Enable the serde feature to serialize and deserialize Rust structs:
= { = "0.1.2", = ["serde"] }
use ;
use ;
CLI Utility: mc-inspect
Inspect Minecraft files directly from your terminal:
# Install the CLI tool
# Inspect a level.dat file
# Peek at a specific chunk in an Anvil file
License
This project is licensed under the GPL-3.0-or-later License - see the LICENSE file for details.