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 |
#141 in Games
37 downloads per month
Used in 2 crates
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.4–2MB
~44K SLoC