mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
remove entities packet
This commit is contained in:
parent
98eee6d908
commit
f62a681474
5 changed files with 35 additions and 0 deletions
|
@ -304,6 +304,9 @@ impl Client {
|
||||||
.write(ServerboundKeepAlivePacket { id: p.id }.get())
|
.write(ServerboundKeepAlivePacket { id: p.id }.get())
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
GamePacket::ClientboundRemoveEntitiesPacket(p) => {
|
||||||
|
println!("Got remove entities packet {:?}", p);
|
||||||
|
}
|
||||||
_ => panic!("Unexpected packet {:?}", packet),
|
_ => panic!("Unexpected packet {:?}", packet),
|
||||||
}
|
}
|
||||||
println!();
|
println!();
|
||||||
|
|
|
@ -360,6 +360,18 @@ impl McBufVarReadable for u16 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vec<T> varint
|
||||||
|
impl<T: McBufVarReadable> McBufVarReadable for Vec<T> {
|
||||||
|
fn var_read_into(buf: &mut impl Read) -> Result<Self, String> {
|
||||||
|
let length = buf.read_varint()? as usize;
|
||||||
|
let mut contents = Vec::with_capacity(length);
|
||||||
|
for _ in 0..length {
|
||||||
|
contents.push(T::var_read_into(buf)?);
|
||||||
|
}
|
||||||
|
Ok(contents)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// i64
|
// i64
|
||||||
impl McBufReadable for i64 {
|
impl McBufReadable for i64 {
|
||||||
fn read_into(buf: &mut impl Read) -> Result<Self, String> {
|
fn read_into(buf: &mut impl Read) -> Result<Self, String> {
|
||||||
|
|
|
@ -257,6 +257,17 @@ impl McBufVarWritable for u16 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vec<T> varint
|
||||||
|
impl<T: McBufVarWritable> McBufVarWritable for Vec<T> {
|
||||||
|
fn var_write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
|
||||||
|
u32::var_write_into(&(self.len() as u32), buf)?;
|
||||||
|
for i in self {
|
||||||
|
i.var_write_into(buf)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// u8
|
// u8
|
||||||
impl McBufWritable for u8 {
|
impl McBufWritable for u8 {
|
||||||
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
|
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
use packet_macros::GamePacket;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, GamePacket)]
|
||||||
|
pub struct ClientboundRemoveEntitiesPacket {
|
||||||
|
#[var]
|
||||||
|
pub entity_ids: Vec<u32>,
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ pub mod clientbound_player_abilities_packet;
|
||||||
pub mod clientbound_player_info_packet;
|
pub mod clientbound_player_info_packet;
|
||||||
pub mod clientbound_player_position_packet;
|
pub mod clientbound_player_position_packet;
|
||||||
pub mod clientbound_recipe_packet;
|
pub mod clientbound_recipe_packet;
|
||||||
|
pub mod clientbound_remove_entities_packet;
|
||||||
pub mod clientbound_rotate_head_packet;
|
pub mod clientbound_rotate_head_packet;
|
||||||
pub mod clientbound_set_carried_item_packet;
|
pub mod clientbound_set_carried_item_packet;
|
||||||
pub mod clientbound_set_chunk_cache_center;
|
pub mod clientbound_set_chunk_cache_center;
|
||||||
|
@ -68,6 +69,7 @@ declare_state_packets!(
|
||||||
0x36: clientbound_player_info_packet::ClientboundPlayerInfoPacket,
|
0x36: clientbound_player_info_packet::ClientboundPlayerInfoPacket,
|
||||||
0x38: clientbound_player_position_packet::ClientboundPlayerPositionPacket,
|
0x38: clientbound_player_position_packet::ClientboundPlayerPositionPacket,
|
||||||
0x39: clientbound_recipe_packet::ClientboundRecipePacket,
|
0x39: clientbound_recipe_packet::ClientboundRecipePacket,
|
||||||
|
0x3a: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket,
|
||||||
0x3e: clientbound_rotate_head_packet::ClientboundRotateHeadPacket,
|
0x3e: clientbound_rotate_head_packet::ClientboundRotateHeadPacket,
|
||||||
0x48: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket,
|
0x48: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket,
|
||||||
0x49: clientbound_set_chunk_cache_center::ClientboundSetChunkCacheCenterPacket,
|
0x49: clientbound_set_chunk_cache_center::ClientboundSetChunkCacheCenterPacket,
|
||||||
|
|
Loading…
Add table
Reference in a new issue