2023-01-28 22:29:12 +01:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
use anyhow::Result;
|
|
|
|
use clap::Parser;
|
|
|
|
|
2023-02-18 11:51:24 +01:00
|
|
|
use minedmap::{resource, world};
|
|
|
|
|
2023-01-28 22:29:12 +01:00
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
struct Args {
|
|
|
|
/// Filename to dump
|
|
|
|
file: PathBuf,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
let args = Args::parse();
|
|
|
|
|
2023-02-18 11:51:24 +01:00
|
|
|
let block_types = resource::block_types();
|
|
|
|
|
2023-01-28 22:29:12 +01:00
|
|
|
minedmap::io::region::from_file(args.file.as_path())?.foreach_chunk(
|
2023-02-18 11:51:24 +01:00
|
|
|
|coords, data: world::de::Chunk| {
|
|
|
|
let chunk = match world::chunk::Chunk::new(&data) {
|
|
|
|
Ok(chunk) => chunk,
|
|
|
|
Err(err) => {
|
|
|
|
eprintln!("Chunk {:?}: {}", coords, err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
match world::layer::top_layer(&chunk, &block_types) {
|
|
|
|
Ok(_) => {}
|
|
|
|
Err(err) => println!("{:?}", err),
|
|
|
|
}
|
2023-01-28 22:29:12 +01:00
|
|
|
},
|
|
|
|
)
|
2023-01-24 18:52:44 +01:00
|
|
|
}
|