Trait base::world::ChunkProvider
[−]
[src]
pub trait ChunkProvider: Send { fn load_chunk(&self, pos: ChunkIndex) -> Option<Chunk>; fn is_chunk_loadable(&self, pos: ChunkIndex) -> bool; fn get_plant_list(&self) -> Vec<Plant>; }
A type that can load a game world, specifically single chunks of it. This could mean loading a saved world from a file, generating a world procedurally or loading a world from a server.
Required Methods
fn load_chunk(&self, pos: ChunkIndex) -> Option<Chunk>
Attempt to load a chunk from the world. This may fail (e.g. when loading from a file and the chunk is not yet saved in the file).
The given position is not a world position, but a chunk index. See the
documentation of ChunkIndex
for more information.
Warning
This function may take some time to complete! To check whether a chunk
can be loaded at all, prefer is_chunk_loadable()
.
fn is_chunk_loadable(&self, pos: ChunkIndex) -> bool
Determines whether or not the chunk at the given position can be loaded. This function is expected to return quickly.
fn get_plant_list(&self) -> Vec<Plant>
Returns a Vector of all specific plants to be rendered in the world.
Implementors
impl ChunkProvider for WorldGenerator
impl ChunkProvider for NullProvider
impl<P: ChunkProvider, F: ChunkProvider> ChunkProvider for FallbackProvider<P, F>