//! Example taken from [litemapy README](https://github.com/SmylerMC/litemapy#example) use mcdata::{latest::BlockState, util::BlockPos}; use rustmatica::{Litematic, Region}; fn main() -> Result<(), Box> { let mut region: Region = Region::new("Planet", BlockPos::new(0, 0, 0), BlockPos::new(21, 21, 21)); for (pos, _) in region.clone().blocks() { if (((pos.x - 10).pow(2) + (pos.y - 10).pow(2) + (pos.z - 10).pow(2)) as f64) .sqrt() .round() <= 10.0 { region.set_block(pos, BlockState::LightBlueConcrete) } } let planet = region.as_litematic("Made with rustmatica", "RubixDev"); planet.write_file("planet.litematic")?; let planet: Litematic = Litematic::read_file("planet.litematic")?; let region = &planet.regions[0]; for x in region.x_range() { for z in region.z_range() { if region.get_block(BlockPos::new(x, 10, z)) == &BlockState::Air { print!(" "); } else { print!("#") } } println!(); } Ok(()) }