Struct mc_core::world::level::Level [−][src]
pub struct Level {
pub chunks: ChunkStorage,
pub entities: EntityStorage,
// some fields omitted
}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
pub fn new<S>(
id: String,
env: Arc<LevelEnv>,
height: ChunkHeight,
source: S
) -> Self where
S: LevelSource + 'static,
Return the minimum and maximum chunks position allowed in this world. The limits can -128 to 127, it is more than enough.
Request internal level source to load the given chunk.
pub fn load_chunks_with_callback<F>(&mut self, callback: F) where
F: FnMut(i32, i32, Result<&Arc<RwLock<Chunk>>, LevelSourceError>),
pub fn load_chunks_with_callback<F>(&mut self, callback: F) where
F: FnMut(i32, i32, Result<&Arc<RwLock<Chunk>>, LevelSourceError>),
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.
Poll loaded chunks from internal level source, all successfully loaded chunks
are added to the underlying LevelStorage.
Returns the number of chunks being loaded or queued for loading (use load_chunks or
load_chunks_with_callback to load actually them.
