aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-10-07 20:12:36 -0500
committerGitHub <noreply@github.com>2022-10-07 20:12:36 -0500
commitbc3aa9467ae1e2d0ea1727093af9b0af14965e69 (patch)
tree8db3b735daed484507129eb0683db88ddec14210 /azalea-client/src
parent695efef66fdf1e08f0cb6d8783c085875100fa2d (diff)
downloadazalea-drasl-bc3aa9467ae1e2d0ea1727093af9b0af14965e69.tar.xz
Replace impl Read with Cursor<&[u8]> (#26)
* Start getting rid of Cursor * try to make the tests pass and fail * make the tests pass * remove unused uses * fix clippy warnings * fix potential OOM exploits * fix OOM in az-nbt * fix nbt benchmark * fix a test * start replacing it with Cursor<Vec<u8>> * wip * fix all the issues * fix all tests * fix nbt benchmark * fix warnings
Diffstat (limited to 'azalea-client/src')
-rw-r--r--azalea-client/src/client.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index d3363ff2..ed0a75e7 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -31,7 +31,11 @@ use azalea_world::{
};
use log::{debug, error, warn};
use parking_lot::Mutex;
-use std::{fmt::Debug, io, sync::Arc};
+use std::{
+ fmt::Debug,
+ io::{self, Cursor},
+ sync::Arc,
+};
use thiserror::Error;
use tokio::{
io::AsyncWriteExt,
@@ -509,7 +513,7 @@ impl Client {
client
.dimension
.lock()
- .replace_with_packet_data(&pos, &mut p.chunk_data.data.as_slice())
+ .replace_with_packet_data(&pos, &mut Cursor::new(&p.chunk_data.data))
.unwrap();
}
ClientboundGamePacket::LightUpdate(p) => {