pub struct Chunk {
pub sections: Vec<Section>,
pub heightmaps: HashMap<HeightmapKind, Heightmap>,
}
Expand description
A single chunk in a world (16*?*16 blocks). This only contains the 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: Vec<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( buf: &mut Cursor<&[u8]>, dimension_height: u32, min_y: i32, heightmaps_nbt: &NbtCompound, ) -> Result<Self, BufReadError>
pub fn get(&self, pos: &ChunkBlockPos, min_y: i32) -> Option<BlockState>
pub fn get_and_set( &mut self, pos: &ChunkBlockPos, state: BlockState, min_y: i32, ) -> BlockState
pub fn set(&mut self, pos: &ChunkBlockPos, state: BlockState, min_y: i32)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
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<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>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<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>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync 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 data from the given [World
].