diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-12-05 10:59:05 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-05 10:59:05 -0600 |
| commit | 7857a014b92e64361ee237ceae7ef1acc185ac46 (patch) | |
| tree | 5d70ea6b41943493873810e6a03c3483ff90a235 /azalea-protocol/src/packets | |
| parent | ea3e8600126a58f5666d50fbf70dff8209d8979f (diff) | |
| download | azalea-drasl-7857a014b92e64361ee237ceae7ef1acc185ac46.tar.xz | |
1.20.3 (#110)
* 23w40a
* 23w41a
* 23w42a
* 23w43a
* 23w44a
* serialize FormattedText as nbt in network
* use azalea-nbt/serde in azalea-chat
* 23w45a
* fix 23w45a to compile
* handle Object in codegen
* 1.20.3-pre2
* remove unused clientbound_resource_pack_packet.rs
* merge main and make azalea-chat use simdnbt
* 1.20.3-rc1
* fix tests
* use simdnbt 0.3
* fix ServerboundSetJigsawBlockPacket
* 1.20.3
Diffstat (limited to 'azalea-protocol/src/packets')
23 files changed, 354 insertions, 270 deletions
diff --git a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_pop_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_resource_pack_pop_packet.rs new file mode 100644 index 00000000..6533b589 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/clientbound_resource_pack_pop_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundConfigurationPacket; +use uuid::Uuid; + +#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] +pub struct ClientboundResourcePackPopPacket { + pub id: Option<Uuid>, +} diff --git a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_push_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_resource_pack_push_packet.rs new file mode 100644 index 00000000..798f5f98 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/clientbound_resource_pack_push_packet.rs @@ -0,0 +1,13 @@ +use azalea_buf::McBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundConfigurationPacket; +use uuid::Uuid; + +#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] +pub struct ClientboundResourcePackPushPacket { + pub id: Uuid, + pub url: String, + pub hash: String, + pub required: bool, + pub prompt: Option<FormattedText>, +} diff --git a/azalea-protocol/src/packets/configuration/mod.rs b/azalea-protocol/src/packets/configuration/mod.rs index 8244e90a..9516935f 100755 --- a/azalea-protocol/src/packets/configuration/mod.rs +++ b/azalea-protocol/src/packets/configuration/mod.rs @@ -4,7 +4,8 @@ pub mod clientbound_finish_configuration_packet; pub mod clientbound_keep_alive_packet; pub mod clientbound_ping_packet; pub mod clientbound_registry_data_packet; -pub mod clientbound_resource_pack_packet; +pub mod clientbound_resource_pack_pop_packet; +pub mod clientbound_resource_pack_push_packet; pub mod clientbound_update_enabled_features_packet; pub mod clientbound_update_tags_packet; pub mod serverbound_client_information_packet; @@ -32,8 +33,9 @@ declare_state_packets!( 0x03: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, 0x04: clientbound_ping_packet::ClientboundPingPacket, 0x05: clientbound_registry_data_packet::ClientboundRegistryDataPacket, - 0x06: clientbound_resource_pack_packet::ClientboundResourcePackPacket, - 0x07: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket, - 0x08: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, + 0x06: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket, + 0x07: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket, + 0x08: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket, + 0x09: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, } ); diff --git a/azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs index 11149115..6f35525e 100644 --- a/azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs +++ b/azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs @@ -1,8 +1,10 @@ use azalea_buf::McBuf; use azalea_protocol_macros::ServerboundConfigurationPacket; +use uuid::Uuid; #[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] pub struct ServerboundResourcePackPacket { + pub id: Uuid, pub action: Action, } @@ -12,4 +14,7 @@ pub enum Action { Declined = 1, FailedDownload = 2, Accepted = 3, + InvalidUrl = 4, + FailedReload = 5, + Discarded = 6, } diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs index 0bc436be..d55ed50f 100755 --- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs @@ -112,6 +112,7 @@ pub enum BrigadierParser { ItemPredicate, Color, FormattedText, + Style, Message, NbtCompoundTag, NbtTag, diff --git a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs b/azalea-protocol/src/packets/game/clientbound_explode_packet.rs index 720f06a4..ae39135a 100755 --- a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_explode_packet.rs @@ -1,8 +1,11 @@ use std::io::{Cursor, Write}; -use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; +use azalea_buf::{ + BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, +}; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::{ParticleKind, SoundEvent}; #[derive(Clone, Debug, PartialEq, ClientboundGamePacket)] pub struct ClientboundExplodePacket { @@ -14,6 +17,18 @@ pub struct ClientboundExplodePacket { pub knockback_x: f32, pub knockback_y: f32, pub knockback_z: f32, + pub block_interaction: BlockInteraction, + pub small_explosion_particles: ParticleKind, + pub large_explosion_particles: ParticleKind, + pub explosion_sound: SoundEvent, +} + +#[derive(Clone, Copy, Debug, PartialEq, McBuf)] +pub enum BlockInteraction { + Keep, + Destroy, + DestroyWithDecay, + TriggerBlock, } impl McBufReadable for ClientboundExplodePacket { @@ -41,6 +56,11 @@ impl McBufReadable for ClientboundExplodePacket { let knockback_y = f32::read_from(buf)?; let knockback_z = f32::read_from(buf)?; + let block_interaction = BlockInteraction::read_from(buf)?; + let small_explosion_particles = ParticleKind::read_from(buf)?; + let large_explosion_particles = ParticleKind::read_from(buf)?; + let explosion_sound = SoundEvent::read_from(buf)?; + Ok(Self { x, y, @@ -50,6 +70,10 @@ impl McBufReadable for ClientboundExplodePacket { knockback_x, knockback_y, knockback_z, + block_interaction, + small_explosion_particles, + large_explosion_particles, + explosion_sound, }) } } @@ -80,6 +104,12 @@ impl McBufWritable for ClientboundExplodePacket { self.knockback_x.write_into(buf)?; self.knockback_y.write_into(buf)?; self.knockback_z.write_into(buf)?; + + self.block_interaction.write_into(buf)?; + self.small_explosion_particles.write_into(buf)?; + self.large_explosion_particles.write_into(buf)?; + self.explosion_sound.write_into(buf)?; + Ok(()) } } @@ -110,6 +140,10 @@ mod tests { knockback_x: 1_000.0, knockback_y: 2_000.0, knockback_z: 3_000.0, + block_interaction: BlockInteraction::Destroy, + small_explosion_particles: ParticleKind::Explosion, + large_explosion_particles: ParticleKind::ExplosionEmitter, + explosion_sound: SoundEvent::EntityGenericExplode, }; let mut buf = Vec::new(); packet.write_into(&mut buf).unwrap(); 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 6a80e172..41a21def 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs @@ -169,41 +169,3 @@ impl McBufWritable for PackedMessageSignature { Ok(()) } } - -#[cfg(test)] -mod tests { - use super::*; - use std::backtrace::Backtrace; - - // you can remove or update this test if it breaks because mojang changed the - // structure of the packet again - #[test] - fn test_player_chat_packet() { - let data: [u8; 295] = [ - 47, 247, 69, 164, 160, 108, 63, 217, 178, 34, 4, 161, 47, 115, 192, 126, 0, 0, 11, 72, - 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0, 0, 1, 132, 209, 9, 72, 139, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 1, 123, 34, 105, 110, 115, 101, 114, 116, 105, 111, - 110, 34, 58, 34, 98, 111, 116, 48, 34, 44, 34, 99, 108, 105, 99, 107, 69, 118, 101, - 110, 116, 34, 58, 123, 34, 97, 99, 116, 105, 111, 110, 34, 58, 34, 115, 117, 103, 103, - 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 34, 44, 34, 118, 97, 108, 117, 101, - 34, 58, 34, 47, 116, 101, 108, 108, 32, 98, 111, 116, 48, 32, 34, 125, 44, 34, 104, - 111, 118, 101, 114, 69, 118, 101, 110, 116, 34, 58, 123, 34, 97, 99, 116, 105, 111, - 110, 34, 58, 34, 115, 104, 111, 119, 95, 101, 110, 116, 105, 116, 121, 34, 44, 34, 99, - 111, 110, 116, 101, 110, 116, 115, 34, 58, 123, 34, 116, 121, 112, 101, 34, 58, 34, - 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, 97, 121, 101, 114, 34, 44, 34, - 105, 100, 34, 58, 34, 50, 102, 102, 55, 52, 53, 97, 52, 45, 97, 48, 54, 99, 45, 51, - 102, 100, 57, 45, 98, 50, 50, 50, 45, 48, 52, 97, 49, 50, 102, 55, 51, 99, 48, 55, 101, - 34, 44, 34, 110, 97, 109, 101, 34, 58, 123, 34, 116, 101, 120, 116, 34, 58, 34, 98, - 111, 116, 48, 34, 125, 125, 125, 44, 34, 116, 101, 120, 116, 34, 58, 34, 98, 111, 116, - 48, 34, 125, 0, - ]; - // just make sure it doesn't panic - if let Err(e) = ClientboundPlayerChatPacket::read_from(&mut Cursor::new(&data)) { - let default_backtrace = Backtrace::capture(); - let backtrace = std::error::request_ref::<Backtrace>(&e).unwrap_or(&default_backtrace); - eprintln!("{e}\n{backtrace}"); - - panic!("failed to read player chat packet"); - } - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs b/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs new file mode 100644 index 00000000..8b24bbdf --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundResetScorePacket { + pub owner: String, + pub objective_name: Option<String>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs b/azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs new file mode 100644 index 00000000..34836c85 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundResourcePackPopPacket { + pub id: Option<Uuid>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_resource_pack_packet.rs b/azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs index a545ff31..1d5e00b1 100755..100644 --- a/azalea-protocol/src/packets/game/clientbound_resource_pack_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs @@ -1,9 +1,11 @@ use azalea_buf::McBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundResourcePackPacket { +pub struct ClientboundResourcePackPushPacket { + pub id: Uuid, pub url: String, pub hash: String, pub required: bool, diff --git a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs index 3809b5b6..a9481ad1 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs @@ -1,59 +1,82 @@ -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; use std::io::{Cursor, Write}; +use azalea_buf::{McBuf, McBufReadable, McBufWritable}; +use azalea_chat::{numbers::NumberFormat, FormattedText}; +use azalea_core::objectives::ObjectiveCriteria; +use azalea_protocol_macros::ClientboundGamePacket; + #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSetObjectivePacket { pub objective_name: String, pub method: Method, } +#[derive(Clone, Copy, Debug, McBuf)] +pub enum MethodKind { + Add, + Remove, + Change, +} + #[derive(Clone, Debug)] pub enum Method { - Add(DisplayInfo), + Add { + display_name: FormattedText, + render_type: ObjectiveCriteria, + number_format: NumberFormat, + }, Remove, - Change(DisplayInfo), + Change { + display_name: FormattedText, + render_type: ObjectiveCriteria, + number_format: NumberFormat, + }, } impl McBufReadable for Method { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - Ok(match u8::read_from(buf)? { - 0 => Method::Add(DisplayInfo::read_from(buf)?), - 1 => Method::Remove, - 2 => Method::Change(DisplayInfo::read_from(buf)?), - id => return Err(BufReadError::UnexpectedEnumVariant { id: i32::from(id) }), - }) + fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { + let kind = MethodKind::read_from(buf)?; + match kind { + MethodKind::Add => Ok(Method::Add { + display_name: FormattedText::read_from(buf)?, + render_type: ObjectiveCriteria::read_from(buf)?, + number_format: NumberFormat::read_from(buf)?, + }), + MethodKind::Remove => Ok(Method::Remove), + MethodKind::Change => Ok(Method::Change { + display_name: FormattedText::read_from(buf)?, + render_type: ObjectiveCriteria::read_from(buf)?, + number_format: NumberFormat::read_from(buf)?, + }), + } } } impl McBufWritable for Method { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { match self { - Method::Add(info) => { - 0u8.write_into(buf)?; - info.write_into(buf)?; - } - Method::Remove => { - 1u8.write_into(buf)?; + Method::Add { + display_name, + render_type, + number_format, + } => { + MethodKind::Add.write_into(buf)?; + display_name.write_into(buf)?; + render_type.write_into(buf)?; + number_format.write_into(buf)?; } - Method::Change(info) => { - 2u8.write_into(buf)?; - info.write_into(buf)?; + Method::Remove => MethodKind::Remove.write_into(buf)?, + Method::Change { + display_name, + render_type, + number_format, + } => { + MethodKind::Change.write_into(buf)?; + display_name.write_into(buf)?; + render_type.write_into(buf)?; + number_format.write_into(buf)?; } } Ok(()) } } - -#[derive(McBuf, Clone, Debug)] -pub struct DisplayInfo { - pub display_name: FormattedText, - pub render_type: RenderType, -} - -#[derive(McBuf, Copy, Clone, Debug)] -pub enum RenderType { - Integer, - Hearts, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs index 56d14b94..6de53f74 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs @@ -1,61 +1,13 @@ -use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; +use azalea_buf::McBuf; +use azalea_chat::{numbers::NumberFormat, FormattedText}; use azalea_protocol_macros::ClientboundGamePacket; -use std::{ - io::{Cursor, Write}, - ops::Not, -}; -#[derive(Clone, Debug, ClientboundGamePacket)] +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSetScorePacket { pub owner: String, - pub method: Method, - pub objective_name: Option<String>, -} - -impl McBufReadable for ClientboundSetScorePacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let owner = String::read_from(buf)?; - let method_id = u32::var_read_from(buf)?; - let objective_name = String::read_from(buf)?; - let objective_name = objective_name.is_empty().not().then_some(objective_name); - // if it's change, read the score - let method = match method_id { - 0 => Method::Change { - score: u32::var_read_from(buf)?, - }, - 1 => Method::Remove, - id => return Err(BufReadError::UnexpectedEnumVariant { id: id as i32 }), - }; - Ok(ClientboundSetScorePacket { - owner, - method, - objective_name, - }) - } -} - -impl McBufWritable for ClientboundSetScorePacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.owner.write_into(buf)?; - match self.method { - Method::Change { .. } => 0u32, - Method::Remove => 1u32, - } - .var_write_into(buf)?; - // convert None to an empty string - self.objective_name - .as_ref() - .unwrap_or(&String::new()) - .write_into(buf)?; - if let Method::Change { score } = self.method { - score.var_write_into(buf)?; - } - Ok(()) - } -} - -#[derive(Clone, Copy, Debug)] -pub enum Method { - Change { score: u32 }, - Remove, + pub objective_name: String, + #[var] + pub score: u32, + pub display: Option<FormattedText>, + pub number_format: Option<NumberFormat>, } diff --git a/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs b/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs new file mode 100644 index 00000000..a85429a2 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundTickingStatePacket { + pub tick_rate: f32, + pub is_frozen: bool, +} diff --git a/azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs b/azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs new file mode 100644 index 00000000..5a5e6440 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundTickingStepPacket { + #[var] + pub tick_steps: u32, +} 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 2eb93519..efd55761 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs @@ -44,10 +44,10 @@ impl azalea_buf::McBufWritable for DisplayInfo { let mut data: u32 = 0; if self.background.is_some() { - data |= 0b1; + data |= 0b001; } if self.show_toast { - data |= 0b10; + data |= 0b010; } if self.hidden { data |= 0b100; 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 0699eb30..291cb580 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -29,66 +29,58 @@ pub struct ShapelessRecipe { pub ingredients: Vec<Ingredient>, pub result: ItemSlot, } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, McBuf)] pub struct ShapedRecipe { - pub width: usize, - pub height: usize, pub group: String, pub category: CraftingBookCategory, - pub ingredients: Vec<Ingredient>, + pub pattern: ShapedRecipePattern, pub result: ItemSlot, pub show_notification: bool, } -#[derive(Clone, Debug, Copy, PartialEq, McBuf)] -pub enum CraftingBookCategory { - Building = 0, - Redstone, - Equipment, - Misc, +#[derive(Clone, Debug, PartialEq)] +pub struct ShapedRecipePattern { + pub width: usize, + pub height: usize, + pub ingredients: Vec<Ingredient>, } -impl McBufWritable for ShapedRecipe { +impl McBufWritable for ShapedRecipePattern { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { (self.width as u32).var_write_into(buf)?; (self.height as u32).var_write_into(buf)?; - self.group.write_into(buf)?; - self.category.write_into(buf)?; debug_assert_eq!(self.width * self.height, self.ingredients.len()); for ingredient in &self.ingredients { ingredient.write_into(buf)?; } - self.result.write_into(buf)?; - self.show_notification.write_into(buf)?; - Ok(()) } } -impl McBufReadable for ShapedRecipe { + +impl McBufReadable for ShapedRecipePattern { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let width = u32::var_read_from(buf)? as usize; let height = u32::var_read_from(buf)? as usize; - let group = String::read_from(buf)?; - let category = CraftingBookCategory::read_from(buf)?; let mut ingredients = Vec::with_capacity(width * height); for _ in 0..width * height { ingredients.push(Ingredient::read_from(buf)?); } - let result = ItemSlot::read_from(buf)?; - let show_notification = bool::read_from(buf)?; - - Ok(ShapedRecipe { + Ok(ShapedRecipePattern { width, height, - group, - category, ingredients, - result, - show_notification, }) } } +#[derive(Clone, Debug, Copy, PartialEq, McBuf)] +pub enum CraftingBookCategory { + Building = 0, + Redstone, + Equipment, + Misc, +} + #[derive(Clone, Debug, PartialEq, McBuf)] pub struct CookingRecipe { pub group: String, @@ -315,24 +307,26 @@ mod tests { let recipe = Recipe { identifier: ResourceLocation::new("minecraft:crafting_shaped"), data: RecipeData::CraftingShaped(ShapedRecipe { - width: 2, - height: 2, group: String::new(), category: CraftingBookCategory::Building, - ingredients: vec![ - Ingredient { - allowed: vec![ItemSlot::Empty], - }, - Ingredient { - allowed: vec![ItemSlot::Empty], - }, - Ingredient { - allowed: vec![ItemSlot::Empty], - }, - Ingredient { - allowed: vec![ItemSlot::Empty], - }, - ], + pattern: ShapedRecipePattern { + width: 2, + height: 2, + ingredients: vec![ + Ingredient { + allowed: vec![ItemSlot::Empty], + }, + Ingredient { + allowed: vec![ItemSlot::Empty], + }, + Ingredient { + allowed: vec![ItemSlot::Empty], + }, + Ingredient { + allowed: vec![ItemSlot::Empty], + }, + ], + }, result: ItemSlot::Empty, show_notification: false, }), diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index c806f21d..d45ea7b1 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -64,7 +64,9 @@ pub mod clientbound_pong_response_packet; pub mod clientbound_recipe_packet; pub mod clientbound_remove_entities_packet; pub mod clientbound_remove_mob_effect_packet; -pub mod clientbound_resource_pack_packet; +pub mod clientbound_reset_score_packet; +pub mod clientbound_resource_pack_pop_packet; +pub mod clientbound_resource_pack_push_packet; pub mod clientbound_respawn_packet; pub mod clientbound_rotate_head_packet; pub mod clientbound_section_blocks_update_packet; @@ -106,6 +108,8 @@ pub mod clientbound_tab_list_packet; pub mod clientbound_tag_query_packet; pub mod clientbound_take_item_entity_packet; pub mod clientbound_teleport_entity_packet; +pub mod clientbound_ticking_state_packet; +pub mod clientbound_ticking_step_packet; pub mod clientbound_update_advancements_packet; pub mod clientbound_update_attributes_packet; pub mod clientbound_update_mob_effect_packet; @@ -126,6 +130,7 @@ pub mod serverbound_configuration_acknowledged_packet; pub mod serverbound_container_button_click_packet; pub mod serverbound_container_click_packet; pub mod serverbound_container_close_packet; +pub mod serverbound_container_slot_state_changed_packet; pub mod serverbound_custom_payload_packet; pub mod serverbound_edit_book_packet; pub mod serverbound_entity_tag_query; @@ -186,45 +191,46 @@ declare_state_packets!( 0x0c: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket, 0x0d: serverbound_container_click_packet::ServerboundContainerClickPacket, 0x0e: serverbound_container_close_packet::ServerboundContainerClosePacket, - 0x0f: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, - 0x10: serverbound_edit_book_packet::ServerboundEditBookPacket, - 0x11: serverbound_entity_tag_query::ServerboundEntityTagQuery, - 0x12: serverbound_interact_packet::ServerboundInteractPacket, - 0x13: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket, - 0x14: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, - 0x15: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket, - 0x16: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, - 0x17: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket, - 0x18: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, - 0x19: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, - 0x1a: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket, - 0x1b: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket, - 0x1c: serverbound_pick_item_packet::ServerboundPickItemPacket, - 0x1d: serverbound_ping_request_packet::ServerboundPingRequestPacket, - 0x1e: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket, - 0x1f: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket, - 0x20: serverbound_player_action_packet::ServerboundPlayerActionPacket, - 0x21: serverbound_player_command_packet::ServerboundPlayerCommandPacket, - 0x22: serverbound_player_input_packet::ServerboundPlayerInputPacket, - 0x23: serverbound_pong_packet::ServerboundPongPacket, - 0x24: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket, - 0x25: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket, - 0x26: serverbound_rename_item_packet::ServerboundRenameItemPacket, - 0x27: serverbound_resource_pack_packet::ServerboundResourcePackPacket, - 0x28: serverbound_seen_advancements_packet::ServerboundSeenAdvancementsPacket, - 0x29: serverbound_select_trade_packet::ServerboundSelectTradePacket, - 0x2a: serverbound_set_beacon_packet::ServerboundSetBeaconPacket, - 0x2b: serverbound_set_carried_item_packet::ServerboundSetCarriedItemPacket, - 0x2c: serverbound_set_command_block_packet::ServerboundSetCommandBlockPacket, - 0x2d: serverbound_set_command_minecart_packet::ServerboundSetCommandMinecartPacket, - 0x2e: serverbound_set_creative_mode_slot_packet::ServerboundSetCreativeModeSlotPacket, - 0x2f: serverbound_set_jigsaw_block_packet::ServerboundSetJigsawBlockPacket, - 0x30: serverbound_set_structure_block_packet::ServerboundSetStructureBlockPacket, - 0x31: serverbound_sign_update_packet::ServerboundSignUpdatePacket, - 0x32: serverbound_swing_packet::ServerboundSwingPacket, - 0x33: serverbound_teleport_to_entity_packet::ServerboundTeleportToEntityPacket, - 0x34: serverbound_use_item_on_packet::ServerboundUseItemOnPacket, - 0x35: serverbound_use_item_packet::ServerboundUseItemPacket, + 0x0f: serverbound_container_slot_state_changed_packet::ServerboundContainerSlotStateChangedPacket, + 0x10: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, + 0x11: serverbound_edit_book_packet::ServerboundEditBookPacket, + 0x12: serverbound_entity_tag_query::ServerboundEntityTagQuery, + 0x13: serverbound_interact_packet::ServerboundInteractPacket, + 0x14: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket, + 0x15: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, + 0x16: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket, + 0x17: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, + 0x18: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket, + 0x19: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, + 0x1a: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, + 0x1b: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket, + 0x1c: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket, + 0x1d: serverbound_pick_item_packet::ServerboundPickItemPacket, + 0x1e: serverbound_ping_request_packet::ServerboundPingRequestPacket, + 0x1f: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket, + 0x20: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket, + 0x21: serverbound_player_action_packet::ServerboundPlayerActionPacket, + 0x22: serverbound_player_command_packet::ServerboundPlayerCommandPacket, + 0x23: serverbound_player_input_packet::ServerboundPlayerInputPacket, + 0x24: serverbound_pong_packet::ServerboundPongPacket, + 0x25: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket, + 0x26: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket, + 0x27: serverbound_rename_item_packet::ServerboundRenameItemPacket, + 0x28: serverbound_resource_pack_packet::ServerboundResourcePackPacket, + 0x29: serverbound_seen_advancements_packet::ServerboundSeenAdvancementsPacket, + 0x2a: serverbound_select_trade_packet::ServerboundSelectTradePacket, + 0x2b: serverbound_set_beacon_packet::ServerboundSetBeaconPacket, + 0x2c: serverbound_set_carried_item_packet::ServerboundSetCarriedItemPacket, + 0x2d: serverbound_set_command_block_packet::ServerboundSetCommandBlockPacket, + 0x2e: serverbound_set_command_minecart_packet::ServerboundSetCommandMinecartPacket, + 0x2f: serverbound_set_creative_mode_slot_packet::ServerboundSetCreativeModeSlotPacket, + 0x30: serverbound_set_jigsaw_block_packet::ServerboundSetJigsawBlockPacket, + 0x31: serverbound_set_structure_block_packet::ServerboundSetStructureBlockPacket, + 0x32: serverbound_sign_update_packet::ServerboundSignUpdatePacket, + 0x33: serverbound_swing_packet::ServerboundSwingPacket, + 0x34: serverbound_teleport_to_entity_packet::ServerboundTeleportToEntityPacket, + 0x35: serverbound_use_item_on_packet::ServerboundUseItemOnPacket, + 0x36: serverbound_use_item_packet::ServerboundUseItemPacket, }, Clientbound => { 0x00: clientbound_bundle_packet::ClientboundBundlePacket, @@ -293,52 +299,56 @@ declare_state_packets!( 0x3f: clientbound_recipe_packet::ClientboundRecipePacket, 0x40: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket, 0x41: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket, - 0x42: clientbound_resource_pack_packet::ClientboundResourcePackPacket, - 0x43: clientbound_respawn_packet::ClientboundRespawnPacket, - 0x44: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, - 0x45: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, - 0x46: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket, - 0x47: clientbound_server_data_packet::ClientboundServerDataPacket, - 0x48: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket, - 0x49: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket, - 0x4a: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket, - 0x4b: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket, - 0x4c: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket, - 0x4d: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket, - 0x4e: clientbound_set_camera_packet::ClientboundSetCameraPacket, - 0x4f: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket, - 0x50: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, - 0x51: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket, - 0x52: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, - 0x53: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket, - 0x54: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, - 0x55: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, - 0x56: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket, - 0x57: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, - 0x58: clientbound_set_experience_packet::ClientboundSetExperiencePacket, - 0x59: clientbound_set_health_packet::ClientboundSetHealthPacket, - 0x5a: clientbound_set_objective_packet::ClientboundSetObjectivePacket, - 0x5b: clientbound_set_passengers_packet::ClientboundSetPassengersPacket, - 0x5c: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket, - 0x5d: clientbound_set_score_packet::ClientboundSetScorePacket, - 0x5e: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket, - 0x5f: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket, - 0x60: clientbound_set_time_packet::ClientboundSetTimePacket, - 0x61: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket, - 0x62: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket, - 0x63: clientbound_sound_entity_packet::ClientboundSoundEntityPacket, - 0x64: clientbound_sound_packet::ClientboundSoundPacket, - 0x65: clientbound_start_configuration_packet::ClientboundStartConfigurationPacket, - 0x66: clientbound_stop_sound_packet::ClientboundStopSoundPacket, - 0x67: clientbound_system_chat_packet::ClientboundSystemChatPacket, - 0x68: clientbound_tab_list_packet::ClientboundTabListPacket, - 0x69: clientbound_tag_query_packet::ClientboundTagQueryPacket, - 0x6a: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket, - 0x6b: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, - 0x6c: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, - 0x6d: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, - 0x6e: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, - 0x6f: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, - 0x70: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, + 0x42: clientbound_reset_score_packet::ClientboundResetScorePacket, + 0x43: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket, + 0x44: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket, + 0x45: clientbound_respawn_packet::ClientboundRespawnPacket, + 0x46: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, + 0x47: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, + 0x48: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket, + 0x49: clientbound_server_data_packet::ClientboundServerDataPacket, + 0x4a: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket, + 0x4b: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket, + 0x4c: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket, + 0x4d: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket, + 0x4e: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket, + 0x4f: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket, + 0x50: clientbound_set_camera_packet::ClientboundSetCameraPacket, + 0x51: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket, + 0x52: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, + 0x53: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket, + 0x54: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, + 0x55: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket, + 0x56: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, + 0x57: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, + 0x58: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket, + 0x59: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, + 0x5a: clientbound_set_experience_packet::ClientboundSetExperiencePacket, + 0x5b: clientbound_set_health_packet::ClientboundSetHealthPacket, + 0x5c: clientbound_set_objective_packet::ClientboundSetObjectivePacket, + 0x5d: clientbound_set_passengers_packet::ClientboundSetPassengersPacket, + 0x5e: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket, + 0x5f: clientbound_set_score_packet::ClientboundSetScorePacket, + 0x60: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket, + 0x61: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket, + 0x62: clientbound_set_time_packet::ClientboundSetTimePacket, + 0x63: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket, + 0x64: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket, + 0x65: clientbound_sound_entity_packet::ClientboundSoundEntityPacket, + 0x66: clientbound_sound_packet::ClientboundSoundPacket, + 0x67: clientbound_start_configuration_packet::ClientboundStartConfigurationPacket, + 0x68: clientbound_stop_sound_packet::ClientboundStopSoundPacket, + 0x69: clientbound_system_chat_packet::ClientboundSystemChatPacket, + 0x6a: clientbound_tab_list_packet::ClientboundTabListPacket, + 0x6b: clientbound_tag_query_packet::ClientboundTagQueryPacket, + 0x6c: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket, + 0x6d: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, + 0x6e: clientbound_ticking_state_packet::ClientboundTickingStatePacket, + 0x6f: clientbound_ticking_step_packet::ClientboundTickingStepPacket, + 0x70: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, + 0x71: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, + 0x72: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, + 0x73: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, + 0x74: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, } ); diff --git a/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs new file mode 100644 index 00000000..8a83f4e2 --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs @@ -0,0 +1,11 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +pub struct ServerboundContainerSlotStateChangedPacket { + #[var] + pub slot_id: u32, + #[var] + pub container_id: u32, + pub new_state: bool, +} diff --git a/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs b/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs index 104f8f73..f285707b 100755 --- a/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs +++ b/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs @@ -1,8 +1,10 @@ use azalea_buf::McBuf; use azalea_protocol_macros::ServerboundGamePacket; +use uuid::Uuid; #[derive(Clone, Debug, McBuf, ServerboundGamePacket)] pub struct ServerboundResourcePackPacket { + pub id: Uuid, pub action: Action, } @@ -12,4 +14,7 @@ pub enum Action { Declined = 1, FailedDownload = 2, Accepted = 3, + InvalidUrl = 4, + FailedReload = 5, + Discarded = 6, } diff --git a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs index a207147a..a4b6f726 100755 --- a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs +++ b/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs @@ -16,6 +16,10 @@ pub struct ServerboundSetJigsawBlockPacket { pub pool: ResourceLocation, pub final_state: String, pub joint: String, + #[var] + pub selection_priority: i32, + #[var] + pub placement_priority: i32, } pub enum JointType { 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 31cd370d..416ec63b 100755 --- a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs @@ -1,8 +1,34 @@ -use azalea_buf::McBuf; +use std::io::{Cursor, Write}; + +use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundLoginPacket; +use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, McBuf, ClientboundLoginPacket)] +#[derive(Clone, Debug, ClientboundLoginPacket)] pub struct ClientboundLoginDisconnectPacket { pub reason: FormattedText, } + +impl McBufReadable for ClientboundLoginDisconnectPacket { + fn read_from( + buf: &mut Cursor<&[u8]>, + ) -> Result<ClientboundLoginDisconnectPacket, BufReadError> { + let disconnect_string = String::read_from(buf)?; + let disconnect_json: serde_json::Value = serde_json::from_str(disconnect_string.as_str())?; + + Ok(ClientboundLoginDisconnectPacket { + reason: FormattedText::deserialize(disconnect_json)?, + }) + } +} + +impl McBufWritable for ClientboundLoginDisconnectPacket { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let status_string = FormattedText::serialize(&self.reason, serde_json::value::Serializer) + .unwrap() + .to_string(); + status_string.write_into(buf)?; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index df3a2bf0..4bb4b7de 100755 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -12,7 +12,7 @@ use std::io::{Cursor, Write}; // TODO: rename the packet files to just like clientbound_add_entity instead of // clientbound_add_entity_packet -pub const PROTOCOL_VERSION: i32 = 764; +pub const PROTOCOL_VERSION: i32 = 765; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { 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 c8b9a208..332bfdc4 100755 --- a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs +++ b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs @@ -2,7 +2,7 @@ use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundStatusPacket; use serde::{Deserialize, Serialize}; -use serde_json::{value::Serializer, Value}; +use serde_json::value::Serializer; use std::io::{Cursor, Write}; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -43,7 +43,7 @@ pub struct ClientboundStatusResponsePacket { impl McBufReadable for ClientboundStatusResponsePacket { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<ClientboundStatusResponsePacket, BufReadError> { let status_string = String::read_from(buf)?; - let status_json: Value = serde_json::from_str(status_string.as_str())?; + let status_json: serde_json::Value = serde_json::from_str(status_string.as_str())?; Ok(ClientboundStatusResponsePacket::deserialize(status_json)?) } |
