diff options
Diffstat (limited to 'azalea-world/src')
| -rw-r--r-- | azalea-world/src/chunk_storage.rs | 2 | ||||
| -rw-r--r-- | azalea-world/src/world.rs | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index d8357a95..9e97a7a7 100644 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -26,7 +26,7 @@ const SECTION_HEIGHT: u32 = 16; pub struct PartialChunkStorage { /// The center of the view, i.e. the chunk the player is currently in. view_center: ChunkPos, - chunk_radius: u32, + pub(crate) chunk_radius: u32, view_range: u32, // chunks is a list of size chunk_radius * chunk_radius chunks: Box<[Option<Arc<RwLock<Chunk>>>]>, diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs index a650f152..4b2b2a19 100644 --- a/azalea-world/src/world.rs +++ b/azalea-world/src/world.rs @@ -41,6 +41,12 @@ impl PartialInstance { entity_infos: PartialEntityInfos::new(owner_entity), } } + + /// Clears the internal references to chunks in the PartialInstance and + /// resets the view center. + pub fn reset(&mut self) { + self.chunks = PartialChunkStorage::new(self.chunks.chunk_radius); + } } /// An entity ID used by Minecraft. |
