pub struct Level {
pub chunks: ChunkStorage,
pub entities: EntityStorage,
/* private fields */
}Expand description
Main storage for a level, part of a World. This structure is intentionally not Sync + Send,
however each chunk is stored in a RwLock in order to make them shared across threads if
you want.
Fields§
§chunks: ChunkStorageChunk storage.
entities: EntityStorageEntities storage.
Implementations§
Source§impl Level
impl Level
pub fn new<S>(
id: String,
env: Arc<LevelEnv>,
height: ChunkHeight,
source: S,
) -> Selfwhere
S: LevelSource + 'static,
Sourcepub fn get_height(&self) -> ChunkHeight
pub fn get_height(&self) -> ChunkHeight
Return the minimum and maximum chunks position allowed in this world. The limits can -128 to 127, it is more than enough.
Sourcepub fn request_chunk_load(&mut self, cx: i32, cz: i32) -> bool
pub fn request_chunk_load(&mut self, cx: i32, cz: i32) -> bool
Request internal level source to load the given chunk.
Sourcepub fn load_chunks_with_callback<F>(&mut self, callback: F)
pub fn load_chunks_with_callback<F>(&mut self, callback: F)
Poll loaded chunks from internal level source, all successfully loaded chunks
are added to the underlying LevelStorage. The callback is called for each
loaded chunks or loading error.
Sourcepub fn load_chunks(&mut self)
pub fn load_chunks(&mut self)
Poll loaded chunks from internal level source, all successfully loaded chunks
are added to the underlying LevelStorage.
Sourcepub fn get_loading_chunks_count(&self) -> usize
pub fn get_loading_chunks_count(&self) -> usize
Returns the number of chunks being loaded or queued for loading (use load_chunks or
load_chunks_with_callback to load actually them.