MinedMap/examples/regiondump.rs

29 lines
597 B
Rust
Raw Normal View History

//! Dumps data from a region data file in a human-readable format
#![warn(missing_docs)]
#![warn(clippy::missing_docs_in_private_items)]
use std::path::PathBuf;
2023-01-25 19:08:23 +01:00
use anyhow::Result;
2023-01-25 19:08:23 +01:00
use clap::Parser;
2023-08-20 17:04:55 +02:00
/// Dump a Minecraft NBT region file in a human-readable format
2023-01-25 19:08:23 +01:00
#[derive(Debug, Parser)]
2023-08-21 13:19:00 +02:00
#[command(version)]
2023-01-25 19:08:23 +01:00
struct Args {
/// Filename to dump
file: PathBuf,
}
fn main() -> Result<()> {
let args = Args::parse();
minedmap_nbt::region::from_file(args.file.as_path())?.foreach_chunk(
2023-01-27 23:01:01 +01:00
|coords, value: fastnbt::Value| {
println!("Chunk {:?}: {:#x?}", coords, value);
Ok(())
2023-01-27 23:01:01 +01:00
},
)
2023-01-25 19:08:23 +01:00
}