Struct SubChunk

Source
pub struct SubChunk {
    pub palette: Vec<Block>,
    pub sky_block_light_array: [Light; 4096],
    pub biome_array: [Biome; 64],
    /* private fields */
}

Fields§

§palette: Vec<Block>

All kinds of blocks

§sky_block_light_array: [Light; 4096]

Skylight, yzx

§biome_array: [Biome; 64]

Biomes, zx

Implementations§

Source§

impl SubChunk

Source

pub fn new() -> SubChunk

Source

pub fn block_id(&self) -> ArrayView3<'_, u16>

Source

pub fn sky_block_light(&self) -> ArrayView3<'_, Light>

Source

pub fn biome(&self) -> ArrayView2<'_, Biome>

Source

pub fn biome_at(&self, r_pos: [i32; 3]) -> Biome

Trait Implementations§

Source§

impl Clone for SubChunk

Source§

fn clone(&self) -> SubChunk

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SubChunk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HasPalette for SubChunk

Source§

fn palette(&self) -> &[Block]

Source§

fn find_in_palette(&self, block: &Block) -> Option<u16>

Find the block index of a block in palette
Source§

fn block_index_of_air(&self) -> Option<u16>

Returns the block index of air in this region
Source§

fn block_index_of_structure_void(&self) -> Option<u16>

Returns the block index of structure void in this region
Source§

impl WorldSlice for SubChunk

Source§

fn shape(&self) -> [i32; 3]

Shape in x, y, z
Source§

fn total_blocks(&self, include_air: bool) -> u64

Returns the count of blocks in region. Air will be counted if include_air is true, structure void is never counted.
Source§

fn block_index_at(&self, r_pos: [i32; 3]) -> Option<u16>

Get block index at r_pos, returns None if the block is outside the region
Source§

fn block_at(&self, r_pos: [i32; 3]) -> Option<&Block>

Get block at r_pos, returns None if the block is outside the region
Source§

fn block_entity_at(&self, _r_pos: [i32; 3]) -> Option<&BlockEntity>

Get block entity at r_pos
Source§

fn pending_tick_at(&self, _r_pos: [i32; 3]) -> &[PendingTick]

Get pending tick at r_pos
Source§

fn contains_coord(&self, r_pos: [i32; 3]) -> bool

If r_pos is inside the region
Source§

fn volume(&self) -> u64

Returns the volume
Source§

fn block_info_at( &self, r_pos: [i32; 3], ) -> Option<(u16, &Block, Option<&BlockEntity>, &[PendingTick])>

Returns detailed block infos at r_pos, including block index, block, block entity and pending tick. Returns None if the block is outside the region

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.