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 Litematic;
use UVec3;
// type must be declared explicitly for Rust to use the default generics
let schem: Litematic = read_file?;
// block has type `mcdata::GenericBlockState`
let block = schem.regions.get_block;
assert_eq!;
// properties aren't typed
assert_eq!;
# Ok::
But [mcdata] also offers more concrete types when enabling certain cargo
features. To use these, add a custom dependency on [mcdata] similar to this:
= { = "<version>", = ["latest", "block-states"] }
Then you can use the mcdata::latest::BlockState type instead:
use Litematic;
use ;
use BoundedU8;
let schem: = read_file?;
// block has type `BlockState`
let block = schem.regions.get_block;
assert_eq!;
# Ok::