diff options
| author | mat <github@matdoes.dev> | 2022-06-25 14:25:56 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-25 14:25:56 -0500 |
| commit | c46eb556e2e7964f0709572a0151c181752c3182 (patch) | |
| tree | da65427d74aaa66e002385989faee04c7bac6cbd /azalea-protocol/src/packets | |
| parent | 8755f18c2b0c11a51a81f60b5501d9d57d0c370e (diff) | |
| parent | 77980f0018eca3a192994021b76ad5d05bff88ea (diff) | |
| download | azalea-drasl-c46eb556e2e7964f0709572a0151c181752c3182.tar.xz | |
Merge branch 'main' into 1.19.1
Diffstat (limited to 'azalea-protocol/src/packets')
73 files changed, 374 insertions, 193 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs index 9ef7e05c..0fc7b817 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs @@ -1,4 +1,7 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_core::EntityPos; +use azalea_entity::Entity; +use packet_macros::GamePacket; use uuid::Uuid; #[derive(Clone, Debug, McBuf, GamePacket)] @@ -22,3 +25,17 @@ pub struct ClientboundAddEntityPacket { pub y_vel: i16, pub z_vel: i16, } + +impl From<&ClientboundAddEntityPacket> for Entity { + fn from(p: &ClientboundAddEntityPacket) -> Self { + Self::new( + p.id, + p.uuid, + EntityPos { + x: p.x, + y: p.y, + z: p.z, + }, + ) + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs index f1947d09..ddadc73f 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs @@ -1,10 +1,14 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_core::EntityPos; +use azalea_entity::Entity; +use packet_macros::GamePacket; use uuid::Uuid; +/// This packet is sent by the server when a player comes into visible range, not when a player joins. #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundAddPlayerPacket { #[var] - pub id: i32, + pub id: u32, pub uuid: Uuid, pub x: f64, pub y: f64, @@ -12,3 +16,17 @@ pub struct ClientboundAddPlayerPacket { pub x_rot: i8, pub y_rot: i8, } + +impl From<&ClientboundAddPlayerPacket> for Entity { + fn from(p: &ClientboundAddPlayerPacket) -> Self { + Self::new( + p.id, + p.uuid, + EntityPos { + x: p.x, + y: p.y, + z: p.z, + }, + ) + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs b/azalea-protocol/src/packets/game/clientbound_animate_packet.rs index 0bba1a25..e554da0a 100644 --- a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_animate_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundAnimatePacket { diff --git a/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs index a580440c..2901cb82 100644 --- a/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundBlockChangedAckPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs index f068cc7d..769270ee 100644 --- a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_core::BlockPos; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundBlockUpdatePacket { diff --git a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs b/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs index edda52d9..57cb1f69 100755 --- a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs @@ -1,5 +1,6 @@ -use azalea_core::difficulty::Difficulty; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_core::Difficulty; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundChangeDifficultyPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs b/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs index 58dd0722..75bf0cf7 100644 --- a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_chat::component::Component; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundChatPreviewPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs index d38bbfda..721937a7 100644 --- a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_core::Slot; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundContainerSetContentPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs index b9ccbba4..d01e7459 100755 --- a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs @@ -1,6 +1,7 @@ -use crate::mc_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::UnsizedByteArray; +use azalea_core::ResourceLocation; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundCustomPayloadPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs index 648ca9e0..ee3f21a2 100755 --- a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs @@ -1,8 +1,9 @@ use super::GamePacket; -use crate::mc_buf::McBufVarReadable; -use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; -use azalea_core::resource_location::ResourceLocation; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::McBufVarReadable; +use azalea_buf::{McBufReadable, McBufWritable, Readable, Writable}; +use azalea_core::ResourceLocation; +use packet_macros::GamePacket; use std::{ hash::Hash, io::{Read, Write}, @@ -24,15 +25,15 @@ pub struct BrigadierNumber<T> { max: Option<T>, } impl<T: McBufReadable> McBufReadable for BrigadierNumber<T> { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let flags = buf.read_byte()?; let min = if flags & 0x01 != 0 { - Some(T::read_into(buf)?) + Some(T::read_from(buf)?) } else { None }; let max = if flags & 0x02 != 0 { - Some(T::read_into(buf)?) + Some(T::read_from(buf)?) } else { None }; @@ -123,16 +124,16 @@ pub enum BrigadierParser { } impl McBufReadable for BrigadierParser { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let parser_type = u32::var_read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let parser_type = u32::var_read_from(buf)?; match parser_type { 0 => Ok(BrigadierParser::Bool), - 1 => Ok(BrigadierParser::Float(BrigadierNumber::read_into(buf)?)), - 2 => Ok(BrigadierParser::Double(BrigadierNumber::read_into(buf)?)), - 3 => Ok(BrigadierParser::Integer(BrigadierNumber::read_into(buf)?)), - 4 => Ok(BrigadierParser::Long(BrigadierNumber::read_into(buf)?)), - 5 => Ok(BrigadierParser::String(BrigadierString::read_into(buf)?)), + 1 => Ok(BrigadierParser::Float(BrigadierNumber::read_from(buf)?)), + 2 => Ok(BrigadierParser::Double(BrigadierNumber::read_from(buf)?)), + 3 => Ok(BrigadierParser::Integer(BrigadierNumber::read_from(buf)?)), + 4 => Ok(BrigadierParser::Long(BrigadierNumber::read_from(buf)?)), + 5 => Ok(BrigadierParser::String(BrigadierString::read_from(buf)?)), 6 => { let flags = buf.read_byte()?; Ok(BrigadierParser::Entity { @@ -182,10 +183,10 @@ impl McBufReadable for BrigadierParser { 41 => Ok(BrigadierParser::Dimension), 42 => Ok(BrigadierParser::Time), 43 => Ok(BrigadierParser::ResourceOrTag { - registry_key: buf.read_resource_location()?, + registry_key: ResourceLocation::read_from(buf)?, }), 44 => Ok(BrigadierParser::Resource { - registry_key: buf.read_resource_location()?, + registry_key: ResourceLocation::read_from(buf)?, }), 45 => Ok(BrigadierParser::TemplateMirror), 46 => Ok(BrigadierParser::TemplateRotation), @@ -197,8 +198,8 @@ impl McBufReadable for BrigadierParser { // TODO: BrigadierNodeStub should have more stuff impl McBufReadable for BrigadierNodeStub { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let flags = u8::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let flags = u8::read_from(buf)?; if flags > 31 { println!( "Warning: The flags from a Brigadier node are over 31 ({flags}; {flags:#b}). This is probably a bug.", @@ -216,9 +217,9 @@ impl McBufReadable for BrigadierNodeStub { // argument node if node_type == 2 { let _name = buf.read_utf()?; - let _parser = BrigadierParser::read_into(buf)?; + let _parser = BrigadierParser::read_from(buf)?; let _suggestions_type = if has_suggestions_type { - Some(buf.read_resource_location()?) + Some(ResourceLocation::read_from(buf)?) } else { None }; diff --git a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs index c030d512..e5f35dc9 100644 --- a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_chat::component::Component; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundDisconnectPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs index d0cc7222..a6f6e38d 100644 --- a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; // we can't identify the status in azalea-protocol since they vary depending on the entity #[derive(Clone, Debug, McBuf, GamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs b/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs index 07218c4e..7e2fa606 100644 --- a/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundEntityVelocityPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs index dd5f08f6..f5cb13a1 100644 --- a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundGameEventPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs b/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs index a522eba3..f759cfc9 100644 --- a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundInitializeBorderPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs index 18628c86..adaca872 100644 --- a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundKeepAlivePacket { diff --git a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs index 43bda0b6..f105bd6a 100644 --- a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; use super::clientbound_light_update_packet::ClientboundLightUpdatePacketData; diff --git a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs index 70926268..42c5f412 100644 --- a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_core::BlockPos; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundLevelEventPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs index 9ed08d8a..a9ce57ad 100644 --- a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs @@ -1,5 +1,5 @@ -use crate::mc_buf::McBufVarReadable; -use crate::mc_buf::{McBufReadable, McBufWritable, ParticleData}; +use azalea_buf::{McBufReadable, McBufVarReadable, McBufWritable}; +use azalea_core::ParticleData; use packet_macros::GamePacket; use std::io::{Read, Write}; @@ -20,17 +20,17 @@ pub struct ClientboundLevelParticlesPacket { } impl McBufReadable for ClientboundLevelParticlesPacket { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let particle_id = u32::var_read_into(buf)?; - let override_limiter = bool::read_into(buf)?; - let x = f64::read_into(buf)?; - let y = f64::read_into(buf)?; - let z = f64::read_into(buf)?; - let x_dist = f32::read_into(buf)?; - let y_dist = f32::read_into(buf)?; - let z_dist = f32::read_into(buf)?; - let max_speed = f32::read_into(buf)?; - let count = u32::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let particle_id = u32::var_read_from(buf)?; + let override_limiter = bool::read_from(buf)?; + let x = f64::read_from(buf)?; + let y = f64::read_from(buf)?; + let z = f64::read_from(buf)?; + let x_dist = f32::read_from(buf)?; + let y_dist = f32::read_from(buf)?; + let z_dist = f32::read_from(buf)?; + let max_speed = f32::read_from(buf)?; + let count = u32::read_from(buf)?; let data = ParticleData::read_from_particle_id(buf, particle_id)?; diff --git a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs index f04987ac..adb6e33b 100644 --- a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs @@ -1,5 +1,6 @@ -use crate::mc_buf::BitSet; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::BitSet; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundLightUpdatePacket { diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs index 6ddc6b5a..6b144bac 100755 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs @@ -1,12 +1,13 @@ -use azalea_core::{game_type::GameType, resource_location::ResourceLocation, GlobalPos}; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_core::{GameType, GlobalPos, OptionalGameType, ResourceLocation}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundLoginPacket { pub player_id: u32, pub hardcore: bool, pub game_type: GameType, - pub previous_game_type: Option<GameType>, + pub previous_game_type: OptionalGameType, pub levels: Vec<ResourceLocation>, pub registry_holder: azalea_nbt::Tag, pub dimension_type: ResourceLocation, diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs index 0fc0104a..cd3e3148 100644 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs @@ -1,11 +1,11 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_core::PositionDelta8; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundMoveEntityPosPacket { #[var] - pub entity_id: i32, - pub xa: i16, - pub ya: i16, - pub za: i16, + pub entity_id: u32, + pub delta: PositionDelta8, pub on_ground: bool, } diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs index 5fde1b93..e3422ac0 100644 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs @@ -1,12 +1,13 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_core::PositionDelta8; +use packet_macros::GamePacket; +/// This packet is sent by the server when an entity moves less then 8 blocks. #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundMoveEntityPosRotPacket { #[var] - pub entity_id: i32, - pub xa: i16, - pub ya: i16, - pub za: i16, + pub entity_id: u32, + pub delta: PositionDelta8, pub y_rot: i8, pub x_rot: i8, pub on_ground: bool, diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs index c8d0170b..85515628 100644 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundMoveEntityRotPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs index c3387f7f..bc3c653e 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs @@ -1,5 +1,6 @@ -use crate::mc_buf::{McBufReadable, McBufWritable, Readable}; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::{McBufReadable, McBufWritable, Readable}; +use packet_macros::GamePacket; use std::io::{Read, Write}; #[derive(Clone, Debug, McBuf, GamePacket)] @@ -19,7 +20,7 @@ pub struct PlayerAbilitiesFlags { } impl McBufReadable for PlayerAbilitiesFlags { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let byte = buf.read_byte()?; Ok(PlayerAbilitiesFlags { invulnerable: byte & 1 != 0, diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs index e6941f25..4aac93f4 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs @@ -1,6 +1,7 @@ +use azalea_buf::McBuf; use azalea_chat::component::Component; use azalea_crypto::SaltSignaturePair; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundPlayerChatPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs index cb17f1f5..522a371a 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs @@ -1,6 +1,7 @@ -use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; +use azalea_buf::McBuf; +use azalea_buf::{McBufReadable, McBufWritable, Readable, Writable}; use azalea_chat::component::Component; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; use std::io::{Read, Write}; use uuid::Uuid; @@ -62,14 +63,14 @@ pub struct RemovePlayer { } impl McBufReadable for Action { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let id = buf.read_byte()?; Ok(match id { - 0 => Action::AddPlayer(Vec::<AddPlayer>::read_into(buf)?), - 1 => Action::UpdateGameMode(Vec::<UpdateGameMode>::read_into(buf)?), - 2 => Action::UpdateLatency(Vec::<UpdateLatency>::read_into(buf)?), - 3 => Action::UpdateDisplayName(Vec::<UpdateDisplayName>::read_into(buf)?), - 4 => Action::RemovePlayer(Vec::<RemovePlayer>::read_into(buf)?), + 0 => Action::AddPlayer(Vec::<AddPlayer>::read_from(buf)?), + 1 => Action::UpdateGameMode(Vec::<UpdateGameMode>::read_from(buf)?), + 2 => Action::UpdateLatency(Vec::<UpdateLatency>::read_from(buf)?), + 3 => Action::UpdateDisplayName(Vec::<UpdateDisplayName>::read_from(buf)?), + 4 => Action::RemovePlayer(Vec::<RemovePlayer>::read_from(buf)?), _ => panic!("Unknown player info action id: {}", id), }) } diff --git a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs index 0457269a..d28d6620 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs @@ -1,5 +1,6 @@ -use crate::mc_buf::{McBufReadable, McBufWritable, Readable}; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::{McBufReadable, McBufWritable, Readable}; +use packet_macros::GamePacket; use std::io::{Read, Write}; #[derive(Clone, Debug, McBuf, GamePacket)] @@ -13,7 +14,7 @@ pub struct ClientboundPlayerPositionPacket { /// Client should confirm this packet with Teleport Confirm containing the /// same Teleport ID. #[var] - pub id: i32, + pub id: u32, pub dismount_vehicle: bool, } @@ -27,7 +28,7 @@ pub struct RelativeArguments { } impl McBufReadable for RelativeArguments { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let byte = buf.read_byte()?; Ok(RelativeArguments { x: byte & 0b1 != 0, diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs b/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs index e76504cc..a00774da 100644 --- a/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs @@ -1,6 +1,7 @@ -use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; -use azalea_core::resource_location::ResourceLocation; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::{McBufReadable, McBufWritable, Readable, Writable}; +use azalea_core::ResourceLocation; +use packet_macros::GamePacket; use std::io::{Read, Write}; #[derive(Clone, Debug, McBuf, GamePacket)] @@ -40,7 +41,7 @@ impl McBufWritable for State { } } impl McBufReadable for State { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let state = buf.read_varint()?; Ok(match state { 0 => State::Init, diff --git a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs b/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs index 8f51596d..8c76ec15 100644 --- a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundRemoveEntitiesPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs index 71b485ae..dc7ec881 100644 --- a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundRotateHeadPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs index 6c429edb..60ebe26c 100644 --- a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs @@ -1,6 +1,7 @@ -use crate::mc_buf::{McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; +use azalea_buf::McBuf; +use azalea_buf::{McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; use azalea_core::{ChunkSectionBlockPos, ChunkSectionPos}; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; use std::io::{Read, Write}; #[derive(Clone, Debug, McBuf, GamePacket)] @@ -17,8 +18,8 @@ pub struct BlockStateWithPosition { } impl McBufReadable for BlockStateWithPosition { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let data = u64::var_read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let data = u64::var_read_from(buf)?; let position_part = data & 4095; let state = (data >> 12) as u32; let position = ChunkSectionBlockPos { diff --git a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs index 4c2d94e6..1dddfc1e 100644 --- a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_chat::component::Component; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundServerDataPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs index 003b6ccc..a4ecaaab 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; /// Sent to change the player's slot selection. #[derive(Clone, Debug, McBuf, GamePacket)] diff --git a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs index 7557c16b..ee86ec9d 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetChunkCacheCenterPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs index 7ac42c5c..9e9a7b87 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_core::BlockPos; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetDefaultSpawnPositionPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs index 46a0d582..8e2cfe70 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetDisplayChatPreviewPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs index 8a568689..8cbd6f9b 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs @@ -1,9 +1,10 @@ -use crate::mc_buf::EntityMetadata; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_entity::EntityMetadata; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetEntityDataPacket { #[var] - pub id: i32, + pub id: u32, pub metadata: EntityMetadata, } diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs index e6e3af67..ec1ee0ec 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetEntityLinkPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs index 3acbd58f..769d24bb 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs @@ -1,7 +1,8 @@ +use azalea_buf::McBuf; use azalea_core::Slot; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; -use crate::mc_buf::{McBufReadable, McBufWritable}; +use azalea_buf::{McBufReadable, McBufWritable}; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetEquipmentPacket { @@ -16,14 +17,14 @@ pub struct EquipmentSlots { } impl McBufReadable for EquipmentSlots { - fn read_into(buf: &mut impl std::io::Read) -> Result<Self, String> { + fn read_from(buf: &mut impl std::io::Read) -> Result<Self, String> { let mut slots = vec![]; loop { - let equipment_byte = u8::read_into(buf)?; + let equipment_byte = u8::read_from(buf)?; let equipment_slot = EquipmentSlot::from_byte(equipment_byte & 127) .ok_or_else(|| format!("Invalid equipment slot byte {}", equipment_byte))?; - let item = Slot::read_into(buf)?; + let item = Slot::read_from(buf)?; slots.push((equipment_slot, item)); if equipment_byte & 128 == 0 { break; diff --git a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs index bcb6393d..7387f6dc 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetExperiencePacket { diff --git a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs index 6c75cf63..b99fe86a 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetHealthPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs index 4cad0693..ea4437b7 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSetTimePacket { diff --git a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs index fbc5830b..a8607599 100644 --- a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSoundPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs index dfa75a5b..c531fa1e 100644 --- a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_chat::component::Component; -use packet_macros::{GamePacket, McBuf}; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundSystemChatPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs index c10db7b9..433b0727 100644 --- a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundTeleportEntityPacket { diff --git a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs index daa1ac93..118dd477 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs @@ -1,7 +1,7 @@ -use crate::packets::{McBufReadable, McBufWritable}; +use azalea_buf::{McBuf, McBufReadable, McBufWritable}; use azalea_chat::component::Component; -use azalea_core::{resource_location::ResourceLocation, Slot}; -use packet_macros::{GamePacket, McBuf}; +use azalea_core::{ResourceLocation, Slot}; +use packet_macros::GamePacket; use std::{ collections::HashMap, io::{Read, Write}, @@ -45,8 +45,8 @@ pub struct DisplayFlags { } impl McBufReadable for DisplayFlags { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let data = u32::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let data = u32::read_from(buf)?; Ok(DisplayFlags { background: (data & 0b1) != 0, show_toast: (data & 0b10) != 0, diff --git a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs index d0e7c9ee..c1f57cda 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs @@ -1,6 +1,7 @@ -use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; -use azalea_core::resource_location::ResourceLocation; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::{McBufReadable, McBufWritable, Readable, Writable}; +use azalea_core::ResourceLocation; +use packet_macros::GamePacket; use std::io::{Read, Write}; use uuid::Uuid; @@ -33,7 +34,7 @@ enum Operation { } impl McBufReadable for Operation { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { match buf.read_byte()? { 0 => Ok(Operation::Addition), 1 => Ok(Operation::MultiplyBase), diff --git a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs new file mode 100644 index 00000000..5a446c2f --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs @@ -0,0 +1,16 @@ +use azalea_buf::McBuf; +use packet_macros::GamePacket; + +#[derive(Clone, Debug, McBuf, GamePacket)] +pub struct ClientboundUpdateMobEffectPacket { + #[var] + pub entity_id: u32, + // TODO: have an enum for this + #[var] + pub effect: u32, + pub effect_amplifier: u8, + #[var] + pub effect_duration_ticks: u32, + pub flags: u8, + pub factor_data: Option<azalea_nbt::Tag>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs index 27839919..dc434eb7 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -1,9 +1,10 @@ use std::io::{Read, Write}; -use azalea_core::{resource_location::ResourceLocation, Slot}; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_core::{ResourceLocation, Slot}; +use packet_macros::GamePacket; -use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; +use azalea_buf::{McBufReadable, McBufWritable, Readable, Writable}; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundUpdateRecipesPacket { @@ -48,15 +49,15 @@ impl McBufWritable for ShapedRecipe { } } impl McBufReadable for ShapedRecipe { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let width = buf.read_varint()?.try_into().unwrap(); let height = buf.read_varint()?.try_into().unwrap(); let group = buf.read_utf()?; let mut ingredients = Vec::with_capacity(width * height); for _ in 0..width * height { - ingredients.push(Ingredient::read_into(buf)?); + ingredients.push(Ingredient::read_from(buf)?); } - let result = Slot::read_into(buf)?; + let result = Slot::read_from(buf)?; Ok(ShapedRecipe { width, @@ -128,17 +129,17 @@ impl McBufWritable for Recipe { } impl McBufReadable for Recipe { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let recipe_type = buf.read_resource_location()?; - let identifier = buf.read_resource_location()?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let recipe_type = ResourceLocation::read_from(buf)?; + let identifier = ResourceLocation::read_from(buf)?; // rust doesn't let us match ResourceLocation so we have to do a big // if-else chain :( let data = if recipe_type == ResourceLocation::new("minecraft:crafting_shapeless").unwrap() { - RecipeData::CraftingShapeless(ShapelessRecipe::read_into(buf)?) + RecipeData::CraftingShapeless(ShapelessRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:crafting_shaped").unwrap() { - RecipeData::CraftingShaped(ShapedRecipe::read_into(buf)?) + RecipeData::CraftingShaped(ShapedRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:crafting_special_armordye").unwrap() { @@ -196,17 +197,17 @@ impl McBufReadable for Recipe { { RecipeData::CraftingSpecialSuspiciousStew } else if recipe_type == ResourceLocation::new("minecraft:smelting").unwrap() { - RecipeData::Smelting(CookingRecipe::read_into(buf)?) + RecipeData::Smelting(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:blasting").unwrap() { - RecipeData::Blasting(CookingRecipe::read_into(buf)?) + RecipeData::Blasting(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:smoking").unwrap() { - RecipeData::Smoking(CookingRecipe::read_into(buf)?) + RecipeData::Smoking(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:campfire_cooking").unwrap() { - RecipeData::CampfireCooking(CookingRecipe::read_into(buf)?) + RecipeData::CampfireCooking(CookingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:stonecutting").unwrap() { - RecipeData::Stonecutting(StoneCuttingRecipe::read_into(buf)?) + RecipeData::Stonecutting(StoneCuttingRecipe::read_from(buf)?) } else if recipe_type == ResourceLocation::new("minecraft:smithing").unwrap() { - RecipeData::Smithing(SmithingRecipe::read_into(buf)?) + RecipeData::Smithing(SmithingRecipe::read_from(buf)?) } else { panic!("Unknown recipe type sent by server: {}", recipe_type); }; diff --git a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs index 60794f03..caa97d7b 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs @@ -1,6 +1,8 @@ -use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; -use azalea_core::resource_location::ResourceLocation; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::{McBufReadable, McBufWritable, Readable, Writable}; +use azalea_core::ResourceLocation; +use packet_macros::GamePacket; +use std::ops::Deref; use std::{ collections::HashMap, io::{Read, Write}, @@ -8,7 +10,7 @@ use std::{ #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundUpdateTagsPacket { - pub tags: HashMap<ResourceLocation, Vec<Tags>>, + pub tags: TagMap, } #[derive(Clone, Debug)] @@ -17,28 +19,31 @@ pub struct Tags { pub elements: Vec<i32>, } -impl McBufReadable for HashMap<ResourceLocation, Vec<Tags>> { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { +#[derive(Clone, Debug)] +pub struct TagMap(HashMap<ResourceLocation, Vec<Tags>>); + +impl McBufReadable for TagMap { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { let length = buf.read_varint()? as usize; let mut data = HashMap::with_capacity(length); for _ in 0..length { - let tag_type = buf.read_resource_location()?; + let tag_type = ResourceLocation::read_from(buf)?; let tags_count = buf.read_varint()? as usize; let mut tags_vec = Vec::with_capacity(tags_count); for _ in 0..tags_count { - let tags = Tags::read_into(buf)?; + let tags = Tags::read_from(buf)?; tags_vec.push(tags); } data.insert(tag_type, tags_vec); } - Ok(data) + Ok(TagMap(data)) } } -impl McBufWritable for HashMap<ResourceLocation, Vec<Tags>> { +impl McBufWritable for TagMap { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { buf.write_varint(self.len() as i32)?; - for (k, v) in self { + for (k, v) in &self.0 { k.write_into(buf)?; v.write_into(buf)?; } @@ -46,8 +51,8 @@ impl McBufWritable for HashMap<ResourceLocation, Vec<Tags>> { } } impl McBufReadable for Tags { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let name = buf.read_resource_location()?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let name = ResourceLocation::read_from(buf)?; let elements = buf.read_int_id_list()?; Ok(Tags { name, elements }) } @@ -60,3 +65,11 @@ impl McBufWritable for Tags { Ok(()) } } + +impl Deref for TagMap { + type Target = HashMap<ResourceLocation, Vec<Tags>>; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs index 8288bd73..c0c40f75 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ClientboundUpdateViewDistancePacket { diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index c4435636..f407a697 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -46,23 +46,34 @@ pub mod clientbound_system_chat_packet; pub mod clientbound_teleport_entity_packet; pub mod clientbound_update_advancements_packet; pub mod clientbound_update_attributes_packet; +pub mod clientbound_update_mob_effect_packet; pub mod clientbound_update_recipes_packet; pub mod clientbound_update_tags_packet; pub mod clientbound_update_view_distance_packet; +pub mod serverbound_accept_teleportation_packet; pub mod serverbound_chat_command_packet; pub mod serverbound_chat_preview_packet; pub mod serverbound_custom_payload_packet; pub mod serverbound_keep_alive_packet; +pub mod serverbound_move_player_packet_pos; +pub mod serverbound_move_player_packet_pos_rot; +pub mod serverbound_move_player_packet_rot; +pub mod serverbound_move_player_packet_status_only; use packet_macros::declare_state_packets; declare_state_packets!( GamePacket, Serverbound => { + 0x00: serverbound_accept_teleportation_packet::ServerboundAcceptTeleportationPacket, 0x03: serverbound_chat_command_packet::ServerboundChatCommandPacket, 0x05: serverbound_chat_preview_packet::ServerboundChatPreviewPacket, 0x0c: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, 0x11: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, + 0x13: serverbound_move_player_packet_pos::ServerboundMovePlayerPacketPos, + 0x14: serverbound_move_player_packet_pos_rot::ServerboundMovePlayerPacketPosRot, + 0x15: serverbound_move_player_packet_rot::ServerboundMovePlayerPacketRot, + 0x16: serverbound_move_player_packet_status_only::ServerboundMovePlayerPacketStatusOnly, }, Clientbound => { 0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket, @@ -97,13 +108,13 @@ declare_state_packets!( 0x3c: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, 0x3d: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, 0x3f: clientbound_server_data_packet::ClientboundServerDataPacket, - 0x44: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, 0x47: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket, 0x48: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, 0x49: clientbound_update_view_distance_packet::ClientboundUpdateViewDistancePacket, 0x4a: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, 0x4b: clientbound_set_display_chat_preview_packet::ClientboundSetDisplayChatPreviewPacket, 0x4d: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, + 0x4e: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, 0x4f: clientbound_entity_velocity_packet::ClientboundEntityVelocityPacket, 0x50: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, 0x51: clientbound_set_experience_packet::ClientboundSetExperiencePacket, @@ -114,6 +125,7 @@ declare_state_packets!( 0x63: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, 0x64: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, 0x65: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, + 0x66: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, 0x67: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, 0x68: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, } diff --git a/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs b/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs new file mode 100644 index 00000000..98a9f728 --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use packet_macros::GamePacket; + +#[derive(Clone, Debug, McBuf, GamePacket)] +pub struct ServerboundAcceptTeleportationPacket { + #[var] + pub id: u32, +} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs index 9ae0b79f..6371463b 100644 --- a/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs +++ b/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ServerboundChatCommandPacket { diff --git a/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs index 60535f69..32711d45 100644 --- a/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs +++ b/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ServerboundChatPreviewPacket { diff --git a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs index bef25b59..eecb920b 100644 --- a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs +++ b/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs @@ -1,6 +1,7 @@ -use crate::mc_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use azalea_buf::UnsizedByteArray; +use azalea_core::ResourceLocation; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ServerboundCustomPayloadPacket { diff --git a/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs index c430499e..1edc5a52 100644 --- a/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs +++ b/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{GamePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::GamePacket; #[derive(Clone, Debug, McBuf, GamePacket)] pub struct ServerboundKeepAlivePacket { diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_packet_pos.rs b/azalea-protocol/src/packets/game/serverbound_move_player_packet_pos.rs new file mode 100644 index 00000000..23f4050e --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_move_player_packet_pos.rs @@ -0,0 +1,10 @@ +use azalea_buf::McBuf; +use packet_macros::GamePacket; + +#[derive(Clone, Debug, McBuf, GamePacket)] +pub struct ServerboundMovePlayerPacketPos { + pub x: f64, + pub y: f64, + pub z: f64, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_packet_pos_rot.rs b/azalea-protocol/src/packets/game/serverbound_move_player_packet_pos_rot.rs new file mode 100644 index 00000000..9416461c --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_move_player_packet_pos_rot.rs @@ -0,0 +1,12 @@ +use azalea_buf::McBuf; +use packet_macros::GamePacket; + +#[derive(Clone, Debug, McBuf, GamePacket)] +pub struct ServerboundMovePlayerPacketPosRot { + pub x: f64, + pub y: f64, + pub z: f64, + pub y_rot: f32, + pub x_rot: f32, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_packet_rot.rs b/azalea-protocol/src/packets/game/serverbound_move_player_packet_rot.rs new file mode 100644 index 00000000..0952483a --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_move_player_packet_rot.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use packet_macros::GamePacket; + +#[derive(Clone, Debug, McBuf, GamePacket)] +pub struct ServerboundMovePlayerPacketRot { + pub y_rot: f32, + pub x_rot: f32, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_packet_status_only.rs b/azalea-protocol/src/packets/game/serverbound_move_player_packet_status_only.rs new file mode 100644 index 00000000..fb765c27 --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_move_player_packet_status_only.rs @@ -0,0 +1,7 @@ +use azalea_buf::McBuf; +use packet_macros::GamePacket; + +#[derive(Clone, Debug, McBuf, GamePacket)] +pub struct ServerboundMovePlayerPacketStatusOnly { + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/handshake/client_intention_packet.rs b/azalea-protocol/src/packets/handshake/client_intention_packet.rs index 410c11ab..5f1987e2 100755 --- a/azalea-protocol/src/packets/handshake/client_intention_packet.rs +++ b/azalea-protocol/src/packets/handshake/client_intention_packet.rs @@ -1,5 +1,6 @@ use crate::packets::ConnectionProtocol; -use packet_macros::{HandshakePacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::HandshakePacket; use std::hash::Hash; #[derive(Hash, Clone, Debug, McBuf, HandshakePacket)] diff --git a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs index 1b1da87a..05310fb0 100755 --- a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs @@ -1,6 +1,6 @@ -use crate::mc_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; -use packet_macros::{LoginPacket, McBuf}; +use azalea_buf::{McBuf, UnsizedByteArray}; +use azalea_core::ResourceLocation; +use packet_macros::LoginPacket; use std::hash::Hash; #[derive(Hash, Clone, Debug, McBuf, LoginPacket)] diff --git a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs index dd11f7f7..a06b999b 100755 --- a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs @@ -1,10 +1,8 @@ use std::io::{Read, Write}; use super::LoginPacket; -use crate::mc_buf::McBufReadable; -use crate::mc_buf::{Readable, Writable}; use azalea_auth::game_profile::GameProfile; -use azalea_core::serializable_uuid::SerializableUuid; +use azalea_buf::{McBufReadable, Readable, SerializableUuid, Writable}; use uuid::Uuid; #[derive(Clone, Debug)] @@ -27,7 +25,7 @@ impl ClientboundGameProfilePacket { } pub fn read(buf: &mut impl Read) -> Result<LoginPacket, String> { - let uuid = Uuid::read_into(buf)?; + let uuid = Uuid::read_from(buf)?; let name = buf.read_utf_with_len(16)?; Ok(ClientboundGameProfilePacket { game_profile: GameProfile::new(uuid, name), diff --git a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs index 58d48ffe..f3724c18 100755 --- a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs @@ -1,5 +1,5 @@ +use azalea_buf::McBuf; use packet_macros::LoginPacket; -use packet_macros::McBuf; #[derive(Clone, Debug, McBuf, LoginPacket)] pub struct ClientboundHelloPacket { diff --git a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs index b1323f50..19b2d58e 100755 --- a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs @@ -3,7 +3,7 @@ use std::{ io::{Read, Write}, }; -use crate::mc_buf::{Readable, Writable}; +use azalea_buf::{Readable, Writable}; use super::LoginPacket; diff --git a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs index 9ab09e3b..acc68c82 100644 --- a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs @@ -1,5 +1,6 @@ +use azalea_buf::McBuf; use azalea_chat::component::Component; -use packet_macros::{LoginPacket, McBuf}; +use packet_macros::LoginPacket; #[derive(Clone, Debug, McBuf, LoginPacket)] pub struct ClientboundLoginDisconnectPacket { diff --git a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs b/azalea-protocol/src/packets/login/serverbound_hello_packet.rs index bed93f04..57a3e4d8 100755 --- a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs +++ b/azalea-protocol/src/packets/login/serverbound_hello_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{LoginPacket, McBuf}; +use azalea_buf::McBuf; +use packet_macros::LoginPacket; #[derive(Clone, Debug, McBuf, LoginPacket)] pub struct ServerboundHelloPacket { diff --git a/azalea-protocol/src/packets/login/serverbound_key_packet.rs b/azalea-protocol/src/packets/login/serverbound_key_packet.rs index d57b122a..7a21736b 100644 --- a/azalea-protocol/src/packets/login/serverbound_key_packet.rs +++ b/azalea-protocol/src/packets/login/serverbound_key_packet.rs @@ -1,8 +1,9 @@ +use azalea_buf::McBuf; use azalea_crypto::SaltSignaturePair; -use packet_macros::{LoginPacket, McBuf}; +use packet_macros::LoginPacket; use std::io::{Read, Write}; -use crate::mc_buf::{McBufReadable, McBufWritable}; +use azalea_buf::{McBufReadable, McBufWritable}; #[derive(Clone, Debug, McBuf, LoginPacket)] pub struct ServerboundKeyPacket { @@ -17,13 +18,13 @@ pub enum NonceOrSaltSignature { } impl McBufReadable for NonceOrSaltSignature { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let is_nonce = bool::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let is_nonce = bool::read_from(buf)?; if is_nonce { - Ok(NonceOrSaltSignature::Nonce(Vec::<u8>::read_into(buf)?)) + Ok(NonceOrSaltSignature::Nonce(Vec::<u8>::read_from(buf)?)) } else { Ok(NonceOrSaltSignature::SaltSignature( - SaltSignaturePair::read_into(buf)?, + SaltSignaturePair::read_from(buf)?, )) } } diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index a8915290..499b0062 100755..100644 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -3,18 +3,13 @@ pub mod handshake; pub mod login; pub mod status; +use crate::connect::PacketFlow; +use azalea_buf::{McBufWritable, Readable, Writable}; use std::io::{Read, Write}; -use crate::{ - connect::PacketFlow, - mc_buf::{McBufReadable, McBufWritable, Readable, Writable}, -}; -use num_derive::FromPrimitive; -use num_traits::FromPrimitive; - pub const PROTOCOL_VERSION: u32 = 1073741918; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, FromPrimitive)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { Handshake = -1, Game = 0, @@ -22,6 +17,18 @@ pub enum ConnectionProtocol { Login = 2, } +impl ConnectionProtocol { + pub fn from_i32(i: i32) -> Option<Self> { + match i { + -1 => Some(ConnectionProtocol::Handshake), + 0 => Some(ConnectionProtocol::Game), + 1 => Some(ConnectionProtocol::Status), + 2 => Some(ConnectionProtocol::Login), + _ => None, + } + } +} + #[derive(Clone, Debug)] pub enum Packet { Game(game::GamePacket), @@ -43,8 +50,8 @@ where fn write(&self, buf: &mut impl Write) -> Result<(), std::io::Error>; } -impl crate::mc_buf::McBufReadable for ConnectionProtocol { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { +impl azalea_buf::McBufReadable for ConnectionProtocol { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { ConnectionProtocol::from_i32(buf.read_varint()?) .ok_or_else(|| "Invalid intention".to_string()) } diff --git a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs index 2acdb8c2..e7fb4f2b 100755 --- a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs +++ b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs @@ -4,7 +4,7 @@ use azalea_chat::component::Component; use serde::Deserialize; use serde_json::Value; -use crate::mc_buf::Readable; +use azalea_buf::Readable; use super::StatusPacket; diff --git a/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs b/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs index 3369e6a9..c19d7795 100755 --- a/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs +++ b/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs @@ -1,4 +1,5 @@ -use packet_macros::{McBuf, StatusPacket}; +use azalea_buf::McBuf; +use packet_macros::StatusPacket; #[derive(Clone, Debug, McBuf, StatusPacket)] pub struct ServerboundStatusRequestPacket {} |
