diff options
| -rwxr-xr-x | azalea-client/src/connect.rs | 2 | ||||
| -rwxr-xr-x | azalea-protocol/README.md | 4 | ||||
| -rw-r--r-- | azalea-world/src/lib.rs | 28 |
3 files changed, 9 insertions, 25 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs index e4d7d7e5..984c5d86 100755 --- a/azalea-client/src/connect.rs +++ b/azalea-client/src/connect.rs @@ -271,6 +271,8 @@ impl Client { .lock() .await .world + .as_mut() + .expect("World doesn't exist! We should've gotten a login packet by now.") .replace_with_packet_data(&pos, &mut p.chunk_data.data.as_slice()) .unwrap(); } diff --git a/azalea-protocol/README.md b/azalea-protocol/README.md index 99b8b8d2..0321c7a5 100755 --- a/azalea-protocol/README.md +++ b/azalea-protocol/README.md @@ -2,8 +2,8 @@ Sent and receive Minecraft packets. You should probably use `azalea` or `azalea-client` instead. -The goal is to **only** support the latest Minecraft version in order to ease development. +The goal is to only support the latest Minecraft version in order to ease development. This is not yet complete, search for `TODO` in the code for things that need to be done. -Unfortunately, compiling the crate requires Rust nightly because specialization is not stable yet. +Unfortunately, using azalea-protocol requires Rust nightly because [specialization](https://github.com/rust-lang/rust/issues/31844) is not stable yet. Use `rustup default nightly` to enable it. 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 { |
