Remove: Old chunk packet

This commit is contained in:
Snowiiii 2024-08-13 07:20:56 +02:00
parent 115029a8e0
commit c2bde2f73e
4 changed files with 3 additions and 94 deletions

View File

@ -1,7 +1,6 @@
use std::collections::HashMap;
use crate::{bytebuf::ByteBuffer, BitSet, ClientPacket, VarInt};
use fastnbt::LongArray;
use itertools::Itertools;
use pumpkin_macros::packet;
use pumpkin_world::{chunk::ChunkData, DIRECT_PALETTE_BITS};

View File

@ -1,88 +0,0 @@
use pumpkin_macros::packet;
use crate::{bytebuf::ByteBuffer, BitSet, ClientPacket, VarInt, VarIntType};
#[packet(0x27)]
pub struct CChunkDataUpdateLight {
chunk_x: i32,
chunk_y: i32,
heightmaps: Vec<u8>,
data: Vec<u8>,
block_entites: Vec<BlockEntity>,
sky_light_mask: BitSet,
block_light_mask: BitSet,
empty_sky_light_mask: BitSet,
sky_lights: Vec<SkyLight>,
block_lights: Vec<BlockLight>,
}
impl CChunkDataUpdateLight {
#[allow(clippy::too_many_arguments)]
pub fn new(
chunk_x: i32,
chunk_y: i32,
heightmaps: Vec<u8>,
data: Vec<u8>,
block_entites: Vec<BlockEntity>,
sky_light_mask: BitSet,
block_light_mask: BitSet,
empty_sky_light_mask: BitSet,
sky_lights: Vec<SkyLight>,
block_lights: Vec<BlockLight>,
) -> Self {
Self {
chunk_x,
chunk_y,
heightmaps,
data,
block_entites,
sky_light_mask,
block_light_mask,
empty_sky_light_mask,
sky_lights,
block_lights,
}
}
}
impl ClientPacket for CChunkDataUpdateLight {
fn write(&self, bytebuf: &mut ByteBuffer) {
bytebuf.put_i32(self.chunk_x);
bytebuf.put_i32(self.chunk_y);
bytebuf.put_slice(&self.heightmaps);
bytebuf.put_var_int(&(self.data.len() as VarIntType).into());
bytebuf.put_slice(&self.data);
bytebuf.put_list::<BlockEntity>(&self.block_entites, |p, v| {
p.put_u8(v.packed_xz);
p.put_i16(v.y);
p.put_var_int(&v.typee);
p.put_slice(&v.data);
});
bytebuf.put_bit_set(&self.sky_light_mask);
bytebuf.put_bit_set(&self.block_light_mask);
bytebuf.put_bit_set(&self.empty_sky_light_mask);
bytebuf.put_list::<SkyLight>(&self.sky_lights, |p, v| {
p.put_var_int(&(v.array.len() as VarIntType).into());
p.put_slice(&v.array);
});
bytebuf.put_list::<BlockLight>(&self.block_lights, |p, v| {
p.put_var_int(&(v.array.len() as VarIntType).into());
p.put_slice(&v.array);
});
}
}
pub struct BlockEntity {
packed_xz: u8,
y: i16,
typee: VarInt,
data: Vec<u8>,
}
pub struct SkyLight {
pub array: Vec<u8>,
}
pub struct BlockLight {
pub array: Vec<u8>,
}

View File

@ -2,7 +2,6 @@ mod c_actionbar;
mod c_center_chunk;
mod c_change_difficulty;
mod c_chunk_data;
mod c_chunk_data_update_light;
mod c_disguised_chat_message;
mod c_entity_animation;
mod c_entity_metadata;
@ -31,7 +30,6 @@ pub use c_actionbar::*;
pub use c_center_chunk::*;
pub use c_change_difficulty::*;
pub use c_chunk_data::*;
pub use c_chunk_data_update_light::*;
pub use c_disguised_chat_message::*;
pub use c_entity_animation::*;
pub use c_entity_metadata::*;

View File

@ -17,9 +17,9 @@ use pumpkin_protocol::{
client::{
config::CPluginMessage,
play::{
CCenterChunk, CChunkData, CChunkDataUpdateLight, CGameEvent, CLogin, CPlayerAbilities,
CPlayerInfoUpdate, CRemoveEntities, CRemovePlayerInfo, CSetEntityMetadata,
CSpawnEntity, Metadata, PlayerAction,
CCenterChunk, CChunkData, CGameEvent, CLogin, CPlayerAbilities, CPlayerInfoUpdate,
CRemoveEntities, CRemovePlayerInfo, CSetEntityMetadata, CSpawnEntity, Metadata,
PlayerAction,
},
},
uuid::UUID,