pub struct Chunk {
pub sections: Box<[Section]>,
pub heightmaps: HashMap<HeightmapKind, Heightmap>,
}Expand description
A single chunk in a world (16*?*16 blocks).
This only contains blocks and biomes. You can derive the height of the chunk
from the number of sections, but you need a ChunkStorage to get the
minimum Y coordinate.
Fields§
§sections: Box<[Section]>§heightmaps: HashMap<HeightmapKind, Heightmap>Heightmaps are used for identifying the surface blocks in a chunk.
Usually for clients only WorldSurface and MotionBlocking are
present.
Implementations§
Source§impl Chunk
impl Chunk
pub fn read_with_dimension_height( ctx: Ctx<'_>, buf: &mut Cursor<&[u8]>, dimension_height: u32, min_y: i32, heightmaps_data: &[(HeightmapKind, Box<[u64]>)], ) -> Result<Self, BufReadError>
pub fn get_block_state( &self, pos: &ChunkBlockPos, min_y: i32, ) -> Option<BlockState>
pub fn get_and_set_block_state( &mut self, pos: &ChunkBlockPos, state: BlockState, min_y: i32, ) -> BlockState
pub fn set_block_state( &mut self, pos: &ChunkBlockPos, state: BlockState, min_y: i32, )
Sourcepub fn get_biome_id(&self, pos: ChunkBiomePos, min_y: i32) -> Option<BiomeId>
pub fn get_biome_id(&self, pos: ChunkBiomePos, min_y: i32) -> Option<BiomeId>
Get the BiomeId at the given position, or None if it’s out of
bounds.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Chunk
impl Freeze for Chunkwhere
*const [Section] is !null: Freeze,
PhantomData<[Section]>: Freeze,
*const u8 is !null: Freeze,
PhantomData<(HeightmapKind, Heightmap)>: Freeze,
impl Move for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
impl UnsafeUnpin for Chunkwhere
*const [Section] is !null: UnsafeUnpin,
PhantomData<[Section]>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(HeightmapKind, Heightmap)>: UnsafeUnpin,
impl UnwindSafe for Chunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<A, B> Interchangeable<A> for B
impl<A, B> Interchangeable<A> for B
fn interchangeable_into(self) -> A
fn interchangeable_from(other: A) -> B
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.