diff options
| author | mat <github@matdoes.dev> | 2022-05-05 23:33:08 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-05-05 23:33:08 -0500 |
| commit | e0239865659b2f2750edda7556548f6a2b8d4127 (patch) | |
| tree | 1a2ddf3499ae37bfed4255bf996fef6fd9f1bc84 /azalea-world/src | |
| parent | 1b48cad53ffba45463be41dafb4dfbcab0f46c09 (diff) | |
| download | azalea-drasl-e0239865659b2f2750edda7556548f6a2b8d4127.tar.xz | |
random polish
Diffstat (limited to 'azalea-world/src')
| -rw-r--r-- | azalea-world/src/lib.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/azalea-world/src/lib.rs b/azalea-world/src/lib.rs index 36bbceac..4b8c21e9 100644 --- a/azalea-world/src/lib.rs +++ b/azalea-world/src/lib.rs @@ -55,6 +55,18 @@ impl World { self.storage.view_center = *pos; } } +impl Index<&ChunkPos> for World { + type Output = Option<Arc<Mutex<Chunk>>>; + + fn index(&self, pos: &ChunkPos) -> &Self::Output { + &self.storage[pos] + } +} +impl IndexMut<&ChunkPos> for World { + fn index_mut<'a>(&'a mut self, pos: &ChunkPos) -> &'a mut Self::Output { + &mut self.storage[pos] + } +} pub struct ChunkStorage { view_center: ChunkPos, @@ -150,7 +162,7 @@ pub struct Section { impl McBufReadable for Section { fn read_into(buf: &mut impl Read) -> Result<Self, String> { let block_count = u16::read_into(buf)?; - // this is commented out because apparently the vanilla server just gives us an incorrect block count sometimes + // this is commented out because the vanilla server is wrong // assert!( // block_count <= 16 * 16 * 16, // "A section has more blocks than what should be possible. This is a bug!" |
