diff options
| author | mat <git@matdoes.dev> | 2023-08-01 02:38:49 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-08-01 02:38:49 -0500 |
| commit | 68f01625cc151e57c3639c430da5d47cccf5e39f (patch) | |
| tree | be640ed25b2b495d10bf107302a180bf731e98ca /azalea-world/src/chunk_storage.rs | |
| parent | b762d1dfb28f2e166e5c3b185a12d7b5a6b53885 (diff) | |
| download | azalea-drasl-68f01625cc151e57c3639c430da5d47cccf5e39f.tar.xz | |
improve Instance::find_block
Diffstat (limited to 'azalea-world/src/chunk_storage.rs')
| -rwxr-xr-x | azalea-world/src/chunk_storage.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index d831770c..f0f053fa 100755 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -33,7 +33,7 @@ pub struct PartialChunkStorage { pub struct ChunkStorage { pub height: u32, pub min_y: i32, - pub chunks: HashMap<ChunkPos, Weak<RwLock<Chunk>>>, + pub map: HashMap<ChunkPos, Weak<RwLock<Chunk>>>, } /// A single chunk in a world (16*?*16 blocks). This only contains the blocks @@ -188,7 +188,7 @@ impl PartialChunkStorage { chunk_storage: &mut ChunkStorage, ) { if let Some(chunk) = &chunk { - chunk_storage.chunks.insert(*pos, Arc::downgrade(chunk)); + chunk_storage.map.insert(*pos, Arc::downgrade(chunk)); } else { // don't remove it from the shared storage, since it'll be removed // automatically if this was the last reference @@ -203,12 +203,12 @@ impl ChunkStorage { ChunkStorage { height, min_y, - chunks: HashMap::new(), + map: HashMap::new(), } } pub fn get(&self, pos: &ChunkPos) -> Option<Arc<RwLock<Chunk>>> { - self.chunks.get(pos).and_then(|chunk| chunk.upgrade()) + self.map.get(pos).and_then(|chunk| chunk.upgrade()) } pub fn get_block_state(&self, pos: &BlockPos) -> Option<BlockState> { |
