Skip to content

Commit

Permalink
use put_slice
Browse files Browse the repository at this point in the history
  • Loading branch information
EamonHeffernan committed Oct 19, 2024
1 parent ce9cdac commit f942a65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions pumpkin-protocol/src/bytebuf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ impl ByteBuffer {
self.put_list(v, |p, &v| p.put_var_int(&v.into()))
}

pub fn put_u8_arr(&mut self, v: &[u8]) {
self.put_list(v, |p, &v| p.put_u8(v))
}

/* pub fn get_nbt(&mut self) -> Option<fastnbt::value::Value> {
match crab_nbt::NbtTag::deserialize(self.buf()) {
Ok(v) => Some(v),
Expand Down
5 changes: 3 additions & 2 deletions pumpkin-protocol/src/client/play/c_chunk_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl<'a> ClientPacket for CChunkData<'a> {

self.0.blocks.iter_subchunks().for_each(|chunk| {
let mut chunk_light = [0u8; 2048];
for (i, block) in chunk.into_iter().enumerate() {
for (i, block) in chunk.iter().enumerate() {
if !block.is_air() {
continue;
}
Expand All @@ -139,7 +139,8 @@ impl<'a> ClientPacket for CChunkData<'a> {

buf.put_var_int(&lighting_subchunks.len().into());
for subchunk in lighting_subchunks {
buf.put_u8_arr(&subchunk);
buf.put_var_int(&VarInt(subchunk.len() as i32));
buf.put_slice(&subchunk);
}

// Block Lighting
Expand Down

0 comments on commit f942a65

Please sign in to comment.