Struct tsukurou::world::World [−][src]
pub struct World { /* fields omitted */ }
An ordered collection of blocks that are arranged in 3D space, dynamically loaded as "chunks".
Methods
impl World
[src]
impl World
pub fn new() -> World
[src]
pub fn new() -> World
Creates a World
with an empty set of loaded chunks.
pub fn with_chunks(chunks: HashMap<ChunkLocation, Chunk>) -> World
[src]
pub fn with_chunks(chunks: HashMap<ChunkLocation, Chunk>) -> World
Creates a World
from an existing set of loaded chunks.
pub fn chunk(&self, location: ChunkLocation) -> Option<&Chunk>
[src]
pub fn chunk(&self, location: ChunkLocation) -> Option<&Chunk>
References the chunk at the given location, or returns None
if
not loaded.
pub fn chunk_mut(&mut self, location: ChunkLocation) -> Option<&mut Chunk>
[src]
pub fn chunk_mut(&mut self, location: ChunkLocation) -> Option<&mut Chunk>
Mutably references the chunk at the given location, or returns None
if not loaded.
pub fn chunks(&self) -> Chunks
[src]
pub fn chunks(&self) -> Chunks
Returns a borrowing iterator over the loaded chunks.
pub fn chunks_mut(&mut self) -> ChunksMut
[src]
pub fn chunks_mut(&mut self) -> ChunksMut
Returns a mutably borrowing iterator over the loaded chunks.
pub fn block(&self, location: BlockLocation) -> Option<&Block>
[src]
pub fn block(&self, location: BlockLocation) -> Option<&Block>
References the block at the given location, or returns None
if the
block's parent chunk is not loaded.
pub fn block_mut(&mut self, location: BlockLocation) -> Option<&mut Block>
[src]
pub fn block_mut(&mut self, location: BlockLocation) -> Option<&mut Block>
Mutably references the block at the given location, or returns None
if the block's parent chunk is not loaded.
ⓘImportant traits for Blocks<'a>pub fn blocks(&self) -> Blocks
[src]
pub fn blocks(&self) -> Blocks
Returns a borrowing iterator over the loaded blocks.
ⓘImportant traits for BlocksMut<'a>pub fn blocks_mut(&mut self) -> BlocksMut
[src]
pub fn blocks_mut(&mut self) -> BlocksMut
Returns a mutably borrowing iterator over the loaded blocks.
pub fn load_chunk(
&mut self,
location: ChunkLocation,
chunk: Chunk
) -> Result<(), Chunk>
[src]
pub fn load_chunk(
&mut self,
location: ChunkLocation,
chunk: Chunk
) -> Result<(), Chunk>
Loads this chunk into the set of known loaded chunks.
Errors
Will return Err
if a chunk is already loaded at that location,
returning the passed Chunk
to the caller.
pub fn unload_chunk(&mut self, location: ChunkLocation) -> Option<Chunk>
[src]
pub fn unload_chunk(&mut self, location: ChunkLocation) -> Option<Chunk>
Unloads the given chunk, removing it from the set and returning it,
or returns None
if there is no loaded chunk at that location.
pub fn unload_all(&mut self) -> UnloadedChunks
[src]
pub fn unload_all(&mut self) -> UnloadedChunks
Begins unloading all chunks from the set, returning an iterator over them to allow them to be processed.