From 477c367fc44a2b5c139845f7e8307c6c276d95ee Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 3 May 2022 18:03:10 +0000 Subject: mor echunk stuff --- azalea-world/src/lib.rs | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'azalea-world/src') diff --git a/azalea-world/src/lib.rs b/azalea-world/src/lib.rs index 51bc0764..ea7798f8 100644 --- a/azalea-world/src/lib.rs +++ b/azalea-world/src/lib.rs @@ -38,17 +38,11 @@ impl World { ); return Ok(()); } - let existing_chunk = &self.storage[pos]; - if let Some(existing_chunk) = existing_chunk { - existing_chunk - .lock() - .expect("Couldn't get lock on existing chunk") - .replace_with_packet_data(data)?; - } else { - let chunk = Arc::new(Mutex::new(Chunk::read_with_world(data, self)?)); - println!("Loaded chunk {:?}", chunk); - self.storage[pos] = Some(chunk); - } + // let existing_chunk = &self.storage[pos]; + + let chunk = Arc::new(Mutex::new(Chunk::read_with_world(data, self)?)); + println!("Loaded chunk {:?}", chunk); + self.storage[pos] = Some(chunk); Ok(()) } @@ -131,18 +125,6 @@ impl Chunk { } Ok(Chunk { sections }) } - - fn replace_with_packet_data(&mut self, data: &mut impl Read) -> Result<(), String> { - let section_count = self.sections.len(); - - // this should also replace block entities and set the heightmap - - for i in 0..section_count { - self.sections[i] = Section::read_into(data)?; - } - - Ok(()) - } } impl McBufWritable for Chunk { -- cgit v1.2.3