8 releases (3 stable)

1.0.2 Mar 8, 2024
1.0.1 Mar 7, 2024
0.2.0 Jun 1, 2023
0.1.0 May 31, 2023
0.0.3 Feb 14, 2023

#577 in Parser implementations

Download history 10/week @ 2024-02-19 9/week @ 2024-02-26 351/week @ 2024-03-04 138/week @ 2024-03-11 3/week @ 2024-03-18 43/week @ 2024-04-01

201 downloads per month
Used in world-painter

Apache-2.0

52KB
859 lines

mca-parser

A library for parsing Minecraft's Region files

Usage

// Create a Region from an open file
let mut file = File::open("r.0.0.mca")?;
let region = Region::from_reader(&mut file)?;

// `chunk` is raw chunk data, so we need to parse it
let chunk = region.get_chunk(0, 0)?;
if let Some(chunk) = chunk {
    // Parse the raw chunk data into structured NBT format
    let parsed = chunk.parse()?;
    println!("{:?}", parsed.status);
} else {
    // If the chunk is None, it has not been generated
    println!("Chunk has not been generated.");
}

lib.rs:

mca-parser

A library for parsing Minecraft's Region files

Usage

This library should be pretty simple to use,

// Create a Region from an open file
let mut file = File::open("r.0.0.mca")?;
let region = Region::from_reader(&mut file)?;

// `chunk` is raw chunk data, so we need to parse it
let chunk = region.get_chunk(0, 0)?;
if let Some(chunk) = chunk {
    // Parse the raw chunk data into structured NBT format
    let parsed = chunk.parse()?;
    println!("{:?}", parsed.status);
} else {
    // If the chunk is None, it has not been generated
    println!("Chunk has not been generated.");
}

Dependencies

~1–1.7MB
~39K SLoC