Expand description

minecraft-assets

Crates.io Docs.rs

A library for reading Minecraft asset files and resource packs in Rust.

Example

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");

Documentation

Tests

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:

$ ./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

License

This project is distributed under the terms of the MIT license.

Copyright Ben Reeves 2022

Modules

An API for programmatically accessing Minecraft asset data.

Serde-(de)serializable data types for files in the Minecraft assets/ directory.

Information about the different versions of Minecraft assets.