Rustmatica
A Rust crate for working with Minecraft litematica files
Install / Use
/learn @RubixDev/RustmaticaREADME
rustmatica
A rust crate for working with Minecraft litematica files.
Overview
The two main types of this crate are [Litematic] and [Region]. See their
documentation for more info.
The
examples directory
contains a few basic examples for how to use this crate.
Usage with [mcdata]
rustmatica is tightly coupled with [mcdata] and makes use of its traits for
block states, entities, and block entities. By default, schematics will use
[mcdata]s "generic" types which store most of their data using
[fastnbt::Value]s.
use rustmatica::Litematic;
use mcdata::util::BlockPos;
// type must be declared explicitly for Rust to use the default generics
let schem: Litematic = Litematic::read_file("test_files/axolotl.litematic")?;
// block has type `mcdata::GenericBlockState`
let block = schem.regions[0].get_block(BlockPos::new(1, 0, 1));
assert_eq!(block.name, "minecraft:water");
// properties aren't typed
assert_eq!(block.properties["level"], "0");
# Ok::<(), rustmatica::Error>(())
But [mcdata] also offers more concrete types when enabling certain cargo
features. To use these, add a custom dependency on [mcdata] similar to this:
mcdata = { version = "<version>", features = ["latest", "block-states"] }
Then you can use the mcdata::latest::BlockState type instead:
use rustmatica::Litematic;
use mcdata::{util::BlockPos, latest::BlockState};
use bounded_integer::BoundedU8;
let schem: Litematic<BlockState> = Litematic::read_file("test_files/axolotl.litematic")?;
// block has type `BlockState`
let block = schem.regions[0].get_block(BlockPos::new(1, 0, 1));
assert_eq!(block, &BlockState::Water {
level: BoundedU8::new(0).unwrap(),
});
# Ok::<(), rustmatica::Error>(())
Related Skills
himalaya
347.0kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
taskflow
347.0kname: taskflow description: Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layer
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
