| Crates.io | minecraft-assets |
| lib.rs | minecraft-assets |
| version | 0.0.6 |
| created_at | 2022-01-30 09:16:31.041977+00 |
| updated_at | 2022-02-18 05:29:37.605953+00 |
| description | Parsing Minecraft asset files and resource packs in Rust |
| homepage | https://github.com/BGR360/minecraft-assets-rs |
| repository | https://github.com/BGR360/minecraft-assets-rs |
| max_upload_size | |
| id | 523962 |
| size | 109,110 |
A Rust library for reading asset files and resource packs for any version of Minecraft.
use minecraft_assets::api::AssetPack;
let assets = AssetPack::at_path("~/.minecraft/");
// Load the block states for `oak_planks`
let states = assets.load_blockstates("oak_planks").unwrap();
let variants = states.variants().unwrap();
assert_eq!(variants.len(), 1);
let model_properties = &variants[""].models()[0];
assert_eq!(model_properties.model, "block/oak_planks");
This library is #![warn(missing_docs)], so the documentation is very complete:
assets/<namespace>/blockstates/*.jsonassets/<namespace>/font/*.jsonassets/<namespace>/lang/*.jsonassets/<namespace>/models/block/*.jsonassets/<namespace>/models/item/*.jsonassets/<namespace>/particles/*.jsonassets/<namespace>/shaders/{post,program}/*.jsonassets/<namespace>/textures/*.mcmetaassets/<namespace>/sounds.jsonassets/pack.mcmetadata/<namespace>/advancements/**/*.jsondata/<namespace>/loot_tables/**/*.jsondata/<namespace>/recipes/*.jsondata/<namespace>/structures/**/*.jsondata/<namespace>/tags/**/*.jsonminecraft-assetsIntegration 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:
$ ./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:
$ cargo test --features tests
Licensed under either of
at your option.
Copyright Ben Reeves 2022
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.