aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-03 18:03:10 +0000
committermat <github@matdoes.dev>2022-05-03 18:03:10 +0000
commit477c367fc44a2b5c139845f7e8307c6c276d95ee (patch)
treeec7f3d2432a4f16d4dbdc205b37d68d54cabda2b
parent0bd798045c4328208667df37348e9affb37e384f (diff)
downloadazalea-drasl-477c367fc44a2b5c139845f7e8307c6c276d95ee.tar.xz
mor echunk stuff
-rwxr-xr-xazalea-client/src/connect.rs2
-rwxr-xr-xazalea-protocol/README.md4
-rw-r--r--azalea-world/src/lib.rs28
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 {