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

#629 in Parser implementations

Download history 1/week @ 2024-02-13 10/week @ 2024-02-20 9/week @ 2024-02-27 366/week @ 2024-03-05 122/week @ 2024-03-12 3/week @ 2024-03-19 8/week @ 2024-03-26 35/week @ 2024-04-02

242 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.6MB
~37K SLoC