A Rust library for reading asset files and resource packs for any version of Minecraft.
```rust,norun use minecraftassets::api::AssetPack;
let assets = AssetPack::at_path("~/.minecraft/");
// Load the block states for oak_planks
let states = assets.loadblockstates("oakplanks").unwrap();
let variants = states.variants().unwrap();
assert_eq!(variants.len(), 1);
let modelproperties = &variants[""].models()[0]; asserteq!(modelproperties.model, "block/oakplanks"); ```
This library is #![warn(missing_docs)]
, so the documentation is very complete:
assets/<namespace>/blockstates/*.json
assets/<namespace>/font/*.json
assets/<namespace>/lang/*.json
assets/<namespace>/models/block/*.json
assets/<namespace>/models/item/*.json
assets/<namespace>/particles/*.json
assets/<namespace>/shaders/{post,program}/*.json
assets/<namespace>/textures/*.mcmeta
assets/<namespace>/sounds.json
assets/pack.mcmeta
data/<namespace>/advancements/**/*.json
data/<namespace>/loot_tables/**/*.json
data/<namespace>/recipes/*.json
data/<namespace>/structures/**/*.json
data/<namespace>/tags/**/*.json
minecraft-assets
Integration tests in tests/
use the actual asset files from the
[minecraft-assets
] repository.
That repository is fairly large (~1 GB), so the tests in tests/
do not run by
default. If you'd like to run them, use the tests/setup.sh
script:
txt
$ ./tests/setup.sh
This script will fetch the [minecraft-assets
] repository and check out a few
different versions at various paths in tests/
. Then you can run the
tests by enabling the tests
feature:
txt
$ cargo test --features tests
This project is distributed under the terms of the MIT license.
Copyright Ben Reeves 2022