pub fn load_chunk(&self, chunk_x: i32, chunk_z: i32) -> Result<CompoundTag, ChunkLoadError> {
        let region_x = chunk_x >> 5;
        let region_z = chunk_z >> 5;

        let region_chunk_x = (chunk_x & 31) as u8;
        let region_chunk_z = (chunk_z & 31) as u8;

        let region_name = format!("r.{}.{}.mca", region_x, region_z);
        let region_path = self.folder_path.join(region_name);

        if !region_path.exists() {
            return Err(ChunkLoadError::RegionNotFound { region_x, region_z });
        }

        // TODO: Cache region files.
        let mut region = AnvilRegion::new(region_path)?;

        region.read_chunk(region_chunk_x, region_chunk_z)
    }
/// Load chunks from the specified coordinates.
///
/// # Example
///
/// ```
/// use anvil_region::AnvilChunkProvider;
///
/// let chunk_provider = AnvilChunkProvider::new("test/region");
///
/// let chunk_compound_tag = chunk_provider.load_chunk(4, 2).unwrap();
/// let level_compound_tag = chunk_compound_tag.get_compound_tag("Level").unwrap();
///
/// assert_eq!(level_compound_tag.get_i32("xPos").unwrap(), 4);
/// assert_eq!(level_compound_tag.get_i32("zPos").unwrap(), 2);
/// ```
Load chunks from the specified coordinates.
Load chunks from the specified coordinates .
pub fn load_chunk(&self, chunk_x: i32, chunk_z: i32) -> Result<CompoundTag, ChunkLoadError> {
        let region_x = chunk_x >> 5;
        let region_z = chunk_z >> 5;
        let region_chunk_x = (chunk_x & 31) as u8;
        let region_chunk_z = (chunk_z & 31) as u8;
        let region_name = format!("r.{}.{}.mca", region_x, region_z);
        let region_path = self.folder_path.join(region_name);
        if !region_path.exists() {
            return Err(ChunkLoadError::RegionNotFound { region_x, region_z });
        }
        // TODO: Cache region files.
        let mut region = AnvilRegion::new(region_path)?;
        region.read_chunk(region_chunk_x, region_chunk_z)
    }
pub fn load_chunk ( & self , chunk_x : i32 , chunk_z : i32 ) -> Result < CompoundTag , ChunkLoadError > { let region_x = chunk_x >> 5 ; let region_z = chunk_z >> 5 ; let region_chunk_x = ( chunk_x & 31 ) as u8 ; let region_chunk_z = ( chunk_z & 31 ) as u8 ; let region_name = format ! ( " " region_x region_z ) ; let region_path = self . folder_path . join ( region_name ) ; if ! region_path . exists ( ) { return Err ( ChunkLoadError :: RegionNotFound { region_x , region_z } ) ; } // TODO: Cache region files. let mut region = AnvilRegion :: new ( region_path ) ? ; region . read_chunk ( region_chunk_x , region_chunk_z ) }
Load chunks from the specified coordinates.
Load chunks from the specified coordinates .
&self
chunk_x
i32
chunk_z
i32
&self
chunk_x
i32
chunk_z
i32
example
```
use anvil_region::AnvilChunkProvider.

let chunk_provider = AnvilChunkProvider::new("test/region").

let chunk_compound_tag = chunk_provider.load_chunk(4, 2).unwrap();
let level_compound_tag = chunk_compound_tag.get_compound_tag("Level").unwrap().


` ` ` use anvil_region :: AnvilChunkProvider . let chunk_provider = AnvilChunkProvider :: new ( " test / region " ) . let chunk_compound_tag = chunk_provider . load_chunk ( 4 2 ) . unwrap () ; let level_compound_tag = chunk_compound_tag . get_compound_tag ( " Level " ) . unwrap () .