#region #minecraft #reading #block #chunk #intended #anvil

simple-anvil

A simple anvil file parser intended for use with Minecraft related applications

6 releases

0.3.3 Jun 19, 2022
0.3.2 Jun 4, 2022
0.3.0 May 30, 2022
0.2.0 May 18, 2022
0.1.0 May 9, 2022

#36 in #chunk

MIT license

26KB
353 lines

Simple Anvil

A very barebones Anvil file parser. This is intended to be used for Minecraft related applictions. There is currently only functionality for reading the content from files.

The sole purpose of this library is to get block data. The basic strategy is to read a region file, get a specific chunk from the region, and then get a specific block from a chunk.

Example Usage:

use simple_anvil::region::Region;

fn main() {
    let region = Region::from_file(String::from("r.0.0.mca"));
    let chunk = region.get_chunk(0, 1);
    let block = chunk.get_block(5, -20, 10);
    
    println!("Found: {}", block.name());
}

lib.rs:

Overview

This crate provides a simple interface for reading the contents of Minecraft region files (.rca). This crate contains no functionality for writing and the reading is only to the extent of getting particular blocks, getting biomes, and getting heightmaps.

Example:

use simple_anvil::region::Region
fn main() {
    let region = Region::from_file("r.0.0.mca".to_string());
    let chunk = region.get_chunk(2, 3).unwrap();
    let block = chunk.get_block(5, -12, 9);

    println!("{}", block.id);
}

Dependencies

~0.9–1.5MB
~33K SLoC