Region

Struct Region 

Source
pub struct Region<'a> {
    pub filename: String,
    /* private fields */
}
Expand description

Low level storage of region file contents.

Fields§

§filename: String

The name of the file that the region was derived from.

Implementations§

Source§

impl<'a> Region<'a>

Source

pub fn chunk_data(&self, chunk_x: u32, chunk_z: u32) -> Option<Box<Blob>>

Returns a Blob of all the data for a particular chunk.

§Arguments
  • chunk_x - The x coordinate of the particular chunk
  • chunk_z - The z coordinate of the particular chunk
Source

pub fn from_file(file: String) -> Region<'a>

Returns a region using a region(.mca) file

§Arguments
  • file - The file name and relative path of the region file.
§Examples
use simple_anvil::region::Region;
 
let region = Region::from_file("r.0.0.mca".into());
Source

pub fn get_chunk(&self, chunk_x: u32, chunk_z: u32) -> Option<Chunk>

Returns a Chunk contained within the Region. A region file contains 32x32 chunks.

§Arguments
  • chunk_x - The x coordinate of the particular chunk
  • chunk_z - The z coordinate of the particular chunk
§Examples
use simple_anvil::region::Region;
 
let region = Region::from_file("r.0.0.mca".into());
let chunk = region.get_chunk(11, 2).unwrap();
Source

pub fn get_block(&self, x: i32, y: i32, z: i32) -> Option<Block>

Returns a Block contained within the Region. None is returned if the Chunk the Block would exist in is not fully generated.

§Arguments
  • x - The x coordinate of the block
  • y - The x coordinate of the block
  • z - The x coordinate of the block
§Examples
use simple_anvil::region::Region;
 
let region = Region::from_file("r.0.0.mca".into());
println!("{}", region.get_block(20, 56, 45).unwrap().id);

Trait Implementations§

Source§

impl<'a> Clone for Region<'a>

Source§

fn clone(&self) -> Region<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Region<'a>

§

impl<'a> !RefUnwindSafe for Region<'a>

§

impl<'a> Send for Region<'a>

§

impl<'a> !Sync for Region<'a>

§

impl<'a> Unpin for Region<'a>

§

impl<'a> UnwindSafe for Region<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.