mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-01 13:29:06 +02:00
Move nbtdump and regiondump examples to minedmap-nbt crate
This commit is contained in:
parent
810a05ab36
commit
2544ee9e80
4 changed files with 4 additions and 0 deletions
26
crates/nbt/examples/nbtdump.rs
Normal file
26
crates/nbt/examples/nbtdump.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
//! Dumps data from a NBT data file in a human-readable format
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![warn(clippy::missing_docs_in_private_items)]
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
|
||||
/// Dump a Minecraft NBT data file in a human-readable format
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(version)]
|
||||
struct Args {
|
||||
/// Filename to dump
|
||||
file: PathBuf,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse();
|
||||
|
||||
let value: fastnbt::Value = minedmap_nbt::data::from_file(args.file.as_path())?;
|
||||
println!("{:#x?}", value);
|
||||
|
||||
Ok(())
|
||||
}
|
28
crates/nbt/examples/regiondump.rs
Normal file
28
crates/nbt/examples/regiondump.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
//! 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;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
|
||||
/// Dump a Minecraft NBT region file in a human-readable format
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(version)]
|
||||
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(
|
||||
|coords, value: fastnbt::Value| {
|
||||
println!("Chunk {:?}: {:#x?}", coords, value);
|
||||
Ok(())
|
||||
},
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue