diff options
Diffstat (limited to 'azalea-protocol/src')
38 files changed, 436 insertions, 418 deletions
diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs index cc1b71c1..cf98e419 100755 --- a/azalea-protocol/src/connect.rs +++ b/azalea-protocol/src/connect.rs @@ -104,12 +104,12 @@ pub struct WriteConnection<W: ProtocolPacket> { /// let packet = conn.read().await?; /// match packet { /// ClientboundLoginPacket::Hello(p) => { -/// let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap(); +/// let e = azalea_crypto::encrypt(&p.public_key, &p.challenge).unwrap(); /// /// conn.write( /// ServerboundKeyPacket { /// key_bytes: e.encrypted_public_key, -/// encrypted_challenge: e.encrypted_nonce, +/// encrypted_challenge: e.encrypted_challenge, /// } /// .get(), /// ) @@ -127,6 +127,7 @@ pub struct WriteConnection<W: ProtocolPacket> { /// return Err("login disconnect".into()); /// } /// ClientboundLoginPacket::CustomQuery(p) => {} +/// ClientboundLoginPacket::CookieRequest(_) => {} /// } /// }; /// @@ -404,7 +405,7 @@ impl Connection<ClientboundLoginPacket, ServerboundLoginPacket> { /// match conn.read().await? { /// ClientboundLoginPacket::Hello(p) => { /// // tell Mojang we're joining the server & enable encryption - /// let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap(); + /// let e = azalea_crypto::encrypt(&p.public_key, &p.challenge).unwrap(); /// conn.authenticate( /// &access_token, /// &profile.id, @@ -414,7 +415,7 @@ impl Connection<ClientboundLoginPacket, ServerboundLoginPacket> { /// conn.write( /// ServerboundKeyPacket { /// key_bytes: e.encrypted_public_key, - /// encrypted_challenge: e.encrypted_nonce, + /// encrypted_challenge: e.encrypted_challenge, /// }.get() /// ).await?; /// conn.set_encryption_key(e.secret_key); diff --git a/azalea-protocol/src/packets/common.rs b/azalea-protocol/src/packets/common.rs index 8ad0b753..82f6be70 100644 --- a/azalea-protocol/src/packets/common.rs +++ b/azalea-protocol/src/packets/common.rs @@ -7,7 +7,7 @@ use azalea_core::{ #[derive(Clone, Debug, McBuf)] pub struct CommonPlayerSpawnInfo { - pub dimension_type: ResourceLocation, + pub dimension_type: azalea_registry::DimensionType, pub dimension: ResourceLocation, pub seed: i64, pub game_type: GameMode, diff --git a/azalea-protocol/src/packets/configuration/clientbound_cookie_request_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_cookie_request_packet.rs new file mode 100644 index 00000000..38566564 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/clientbound_cookie_request_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigurationPacket; + +#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] +pub struct ClientboundCookieRequestPacket { + pub key: ResourceLocation, +} diff --git a/azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs index 0e782092..8bada6ca 100644 --- a/azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs +++ b/azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs @@ -1,8 +1,12 @@ +use std::collections::HashMap; + use azalea_buf::McBuf; -use azalea_core::registry_holder::RegistryHolder; +use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundConfigurationPacket; +use simdnbt::owned::NbtCompound; #[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] pub struct ClientboundRegistryDataPacket { - pub registry_holder: RegistryHolder, + pub registry_id: ResourceLocation, + pub entries: HashMap<ResourceLocation, Option<NbtCompound>>, } diff --git a/azalea-protocol/src/packets/configuration/clientbound_reset_chat_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_reset_chat_packet.rs new file mode 100644 index 00000000..75afa8c1 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/clientbound_reset_chat_packet.rs @@ -0,0 +1,5 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundConfigurationPacket; + +#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] +pub struct ClientboundResetChatPacket; diff --git a/azalea-protocol/src/packets/configuration/clientbound_select_known_packs_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_select_known_packs_packet.rs new file mode 100644 index 00000000..0f22b054 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/clientbound_select_known_packs_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundConfigurationPacket; + +use super::serverbound_select_known_packs_packet::KnownPack; + +#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] +pub struct ClientboundSelectKnownPacksPacket { + pub known_packs: Vec<KnownPack>, +} diff --git a/azalea-protocol/src/packets/configuration/clientbound_store_cookie_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_store_cookie_packet.rs new file mode 100644 index 00000000..fda16689 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/clientbound_store_cookie_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigurationPacket; + +#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] +pub struct ClientboundStoreCookiePacket { + pub key: ResourceLocation, + pub payload: Vec<u8>, +} diff --git a/azalea-protocol/src/packets/configuration/clientbound_transfer_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_transfer_packet.rs new file mode 100644 index 00000000..88f0054a --- /dev/null +++ b/azalea-protocol/src/packets/configuration/clientbound_transfer_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundConfigurationPacket; + +#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] +pub struct ClientboundTransferPacket { + pub host: String, + #[var] + pub port: u32, +} diff --git a/azalea-protocol/src/packets/configuration/mod.rs b/azalea-protocol/src/packets/configuration/mod.rs index 9516935f..757c496c 100755 --- a/azalea-protocol/src/packets/configuration/mod.rs +++ b/azalea-protocol/src/packets/configuration/mod.rs @@ -1,41 +1,56 @@ +pub mod clientbound_cookie_request_packet; pub mod clientbound_custom_payload_packet; pub mod clientbound_disconnect_packet; 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_reset_chat_packet; pub mod clientbound_resource_pack_pop_packet; pub mod clientbound_resource_pack_push_packet; +pub mod clientbound_select_known_packs_packet; +pub mod clientbound_store_cookie_packet; +pub mod clientbound_transfer_packet; pub mod clientbound_update_enabled_features_packet; pub mod clientbound_update_tags_packet; pub mod serverbound_client_information_packet; +pub mod serverbound_cookie_response_packet; pub mod serverbound_custom_payload_packet; pub mod serverbound_finish_configuration_packet; pub mod serverbound_keep_alive_packet; pub mod serverbound_pong_packet; pub mod serverbound_resource_pack_packet; +pub mod serverbound_select_known_packs_packet; + use azalea_protocol_macros::declare_state_packets; declare_state_packets!( ConfigurationPacket, Serverbound => { 0x00: serverbound_client_information_packet::ServerboundClientInformationPacket, - 0x01: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, - 0x02: serverbound_finish_configuration_packet::ServerboundFinishConfigurationPacket, - 0x03: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, - 0x04: serverbound_pong_packet::ServerboundPongPacket, - 0x05: serverbound_resource_pack_packet::ServerboundResourcePackPacket, + 0x01: serverbound_cookie_response_packet::ServerboundCookieResponsePacket, + 0x02: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, + 0x03: serverbound_finish_configuration_packet::ServerboundFinishConfigurationPacket, + 0x04: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, + 0x05: serverbound_pong_packet::ServerboundPongPacket, + 0x06: serverbound_resource_pack_packet::ServerboundResourcePackPacket, + 0x07: serverbound_select_known_packs_packet::ServerboundSelectKnownPacksPacket, }, Clientbound => { - 0x00: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, - 0x01: clientbound_disconnect_packet::ClientboundDisconnectPacket, - 0x02: clientbound_finish_configuration_packet::ClientboundFinishConfigurationPacket, - 0x03: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, - 0x04: clientbound_ping_packet::ClientboundPingPacket, - 0x05: clientbound_registry_data_packet::ClientboundRegistryDataPacket, - 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, + 0x00: clientbound_cookie_request_packet::ClientboundCookieRequestPacket, + 0x01: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, + 0x02: clientbound_disconnect_packet::ClientboundDisconnectPacket, + 0x03: clientbound_finish_configuration_packet::ClientboundFinishConfigurationPacket, + 0x04: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, + 0x05: clientbound_ping_packet::ClientboundPingPacket, + 0x06: clientbound_reset_chat_packet::ClientboundResetChatPacket, + 0x07: clientbound_registry_data_packet::ClientboundRegistryDataPacket, + 0x08: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket, + 0x09: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket, + 0x0a: clientbound_store_cookie_packet::ClientboundStoreCookiePacket, + 0x0b: clientbound_transfer_packet::ClientboundTransferPacket, + 0x0c: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket, + 0x0d: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, + 0x0e: clientbound_select_known_packs_packet::ClientboundSelectKnownPacksPacket, } ); diff --git a/azalea-protocol/src/packets/configuration/serverbound_cookie_response_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_cookie_response_packet.rs new file mode 100644 index 00000000..6c62c1c8 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/serverbound_cookie_response_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundConfigurationPacket; + +#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] +pub struct ServerboundCookieResponsePacket { + pub key: ResourceLocation, + pub payload: Option<Vec<u8>>, +} diff --git a/azalea-protocol/src/packets/configuration/serverbound_select_known_packs_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_select_known_packs_packet.rs new file mode 100644 index 00000000..fe379a17 --- /dev/null +++ b/azalea-protocol/src/packets/configuration/serverbound_select_known_packs_packet.rs @@ -0,0 +1,14 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ServerboundConfigurationPacket; + +#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] +pub struct ServerboundSelectKnownPacksPacket { + pub known_packs: Vec<KnownPack>, +} + +#[derive(Clone, Debug, McBuf)] +pub struct KnownPack { + pub namespace: String, + pub id: String, + pub version: String, +} 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 59676fe5..9c8782d0 100755 --- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs @@ -22,21 +22,6 @@ pub struct ClientboundAddEntityPacket { pub z_vel: i16, } -// impl From<&ClientboundAddEntityPacket> for EntityData { -// fn from(p: &ClientboundAddEntityPacket) -> Self { -// Self::new( -// p.uuid, -// Vec3 { -// x: p.x, -// y: p.y, -// z: p.z, -// }, -// // default metadata for the entity type -// EntityMetadata::from(p.entity_type), -// ) -// } -// } - impl ClientboundAddEntityPacket { /// Make the entity into a bundle that can be inserted into the ECS. You /// must apply the metadata after inserting the bundle with diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs index d55ed50f..822f62df 100755 --- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs @@ -128,6 +128,7 @@ pub enum BrigadierParser { Swizzle, Team, ItemSlot, + ItemSlots, ResourceLocation, Function, EntityAnchor, @@ -143,6 +144,9 @@ pub enum BrigadierParser { TemplateMirror, TemplateRotation, Heightmap, + LootTable, + LootPredicate, + LootModifier, Uuid, } diff --git a/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs b/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs new file mode 100755 index 00000000..9f1c1d43 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundCookieRequestPacket { + pub key: ResourceLocation, +} diff --git a/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs b/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs new file mode 100755 index 00000000..641fd05e --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs @@ -0,0 +1,10 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::serverbound_debug_sample_subscription::RemoteDebugSampleType; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundDebugSamplePacket { + pub sample: Vec<u64>, + pub debug_sample_type: RemoteDebugSampleType, +} 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 7cae607e..437eb68e 100755 --- a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs @@ -1,12 +1,9 @@ -use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; -use azalea_core::particle::ParticleData; +use azalea_buf::McBuf; use azalea_protocol_macros::ClientboundGamePacket; -use std::io::{Cursor, Write}; +use azalea_registry::ParticleKind; -#[derive(Clone, Debug, ClientboundGamePacket)] +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundLevelParticlesPacket { - #[var] - pub particle_id: u32, pub override_limiter: bool, pub x: f64, pub y: f64, @@ -15,54 +12,7 @@ pub struct ClientboundLevelParticlesPacket { pub y_dist: f32, pub z_dist: f32, pub max_speed: f32, + #[var] pub count: u32, - pub data: ParticleData, -} - -impl McBufReadable for ClientboundLevelParticlesPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - 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_id(buf, particle_id)?; - - Ok(Self { - particle_id, - override_limiter, - x, - y, - z, - x_dist, - y_dist, - z_dist, - max_speed, - count, - data, - }) - } -} - -impl McBufWritable for ClientboundLevelParticlesPacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.particle_id.var_write_into(buf)?; - self.override_limiter.write_into(buf)?; - self.x.write_into(buf)?; - self.y.write_into(buf)?; - self.z.write_into(buf)?; - self.x_dist.write_into(buf)?; - self.y_dist.write_into(buf)?; - self.z_dist.write_into(buf)?; - self.max_speed.write_into(buf)?; - self.count.write_into(buf)?; - self.data.write_without_id(buf)?; - Ok(()) - } + pub particle: ParticleKind, } diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs index 1b70cbb9..20ed30f0 100755 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs @@ -23,4 +23,5 @@ pub struct ClientboundLoginPacket { pub show_death_screen: bool, pub do_limited_crafting: bool, pub common: CommonPlayerSpawnInfo, + pub enforces_secure_chat: bool, } 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 1a9d9ffc..a70a0aec 100755 --- a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs @@ -6,5 +6,4 @@ use azalea_protocol_macros::ClientboundGamePacket; pub struct ClientboundServerDataPacket { pub motd: FormattedText, pub icon_bytes: Option<Vec<u8>>, - pub enforces_secure_chat: bool, } 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 0acdc687..00f3980a 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs @@ -7,7 +7,7 @@ use std::io::Cursor; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSetEquipmentPacket { #[var] - pub entity: i32, + pub entity_id: u32, pub slots: EquipmentSlots, } diff --git a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs index c7448800..2e9252ae 100755 --- a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs @@ -1,15 +1,27 @@ -use super::clientbound_sound_packet::SoundSource; use azalea_buf::McBuf; use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::OptionalRegistry; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSoundEntityPacket { - pub sound: OptionalRegistry<azalea_registry::SoundEvent>, pub source: SoundSource, #[var] pub id: u32, pub volume: f32, pub pitch: f32, + #[var] pub seed: u64, } + +#[derive(McBuf, Clone, Copy, Debug)] +pub enum SoundSource { + Master = 0, + Music = 1, + Records = 2, + Weather = 3, + Blocks = 4, + Hostile = 5, + Neutral = 6, + Players = 7, + Ambient = 8, + Voice = 9, +} diff --git a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs index e60485a1..4d2493ed 100755 --- a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs @@ -1,10 +1,10 @@ use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::SoundEvent; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSoundPacket { - pub sound: azalea_registry::CustomRegistry<azalea_registry::SoundEvent, CustomSoundEvent>, + pub sound: SoundEvent, pub source: SoundSource, pub x: i32, pub y: i32, @@ -14,12 +14,6 @@ pub struct ClientboundSoundPacket { pub seed: u64, } -#[derive(McBuf, Clone, Debug)] -pub struct CustomSoundEvent { - pub location: ResourceLocation, - pub range: Option<f32>, -} - #[derive(McBuf, Clone, Copy, Debug)] pub enum SoundSource { Master = 0, diff --git a/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs b/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs new file mode 100644 index 00000000..1c8ada28 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundStoreCookiePacket { + pub key: ResourceLocation, + pub payload: Vec<u8>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs b/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs new file mode 100644 index 00000000..dbce36e0 --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] +pub struct ClientboundTransferPacket { + pub host: String, + #[var] + pub port: u32, +} 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 147d3618..19d4a715 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs @@ -1,18 +1,18 @@ use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; use azalea_entity::attributes::AttributeModifier; use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::Attribute; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundUpdateAttributesPacket { #[var] pub entity_id: u32, - pub attributes: Vec<AttributeSnapshot>, + pub values: Vec<AttributeSnapshot>, } #[derive(Clone, Debug, McBuf)] pub struct AttributeSnapshot { - pub attribute: ResourceLocation, + pub attribute: Attribute, pub base: f64, pub modifiers: Vec<AttributeModifier>, } 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 index 37ffd9ce..5c7abf3a 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs @@ -1,15 +1,15 @@ use azalea_buf::McBuf; use azalea_protocol_macros::ClientboundGamePacket; -use simdnbt::owned::NbtTag; +use azalea_registry::MobEffect; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundUpdateMobEffectPacket { #[var] pub entity_id: u32, - pub effect: azalea_registry::MobEffect, - pub effect_amplifier: u8, + pub mob_effect: MobEffect, + #[var] + pub effect_amplifier: u32, #[var] pub effect_duration_ticks: u32, pub flags: u8, - pub factor_data: Option<NbtTag>, } 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 291cb580..99f4ab05 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -4,19 +4,17 @@ use azalea_buf::{ use azalea_core::resource_location::ResourceLocation; use azalea_inventory::ItemSlot; use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::RecipeSerializer; use std::io::{Cursor, Write}; -use std::str::FromStr; #[derive(Clone, Debug, McBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundUpdateRecipesPacket { - pub recipes: Vec<Recipe>, + pub recipes: Vec<RecipeHolder>, } -#[derive(Clone, Debug, PartialEq)] -pub struct Recipe { - pub identifier: ResourceLocation, +#[derive(Clone, Debug, PartialEq, McBuf)] +pub struct RecipeHolder { + pub id: ResourceLocation, pub data: RecipeData, } @@ -156,147 +154,6 @@ pub struct Ingredient { pub allowed: Vec<ItemSlot>, } -impl McBufWritable for Recipe { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let recipe_serializer = match &self.data { - RecipeData::CraftingShapeless(_) => RecipeSerializer::CraftingShapeless, - RecipeData::CraftingShaped(_) => RecipeSerializer::CraftingShaped, - RecipeData::CraftingSpecialArmorDye(_) => RecipeSerializer::CraftingSpecialArmordye, - RecipeData::CraftingSpecialBookCloning(_) => { - RecipeSerializer::CraftingSpecialBookcloning - } - RecipeData::CraftingSpecialMapCloning(_) => RecipeSerializer::CraftingSpecialMapcloning, - RecipeData::CraftingSpecialMapExtending(_) => { - RecipeSerializer::CraftingSpecialMapextending - } - RecipeData::CraftingSpecialFireworkRocket(_) => { - RecipeSerializer::CraftingSpecialFireworkRocket - } - RecipeData::CraftingSpecialFireworkStar(_) => { - RecipeSerializer::CraftingSpecialFireworkStar - } - - RecipeData::CraftingSpecialFireworkStarFade(_) => { - RecipeSerializer::CraftingSpecialFireworkStarFade - } - RecipeData::CraftingSpecialRepairItem(_) => RecipeSerializer::CraftingSpecialRepairitem, - RecipeData::CraftingSpecialTippedArrow(_) => { - RecipeSerializer::CraftingSpecialTippedarrow - } - RecipeData::CraftingSpecialBannerDuplicate(_) => { - RecipeSerializer::CraftingSpecialBannerduplicate - } - RecipeData::CraftingSpecialShieldDecoration(_) => { - RecipeSerializer::CraftingSpecialShielddecoration - } - RecipeData::CraftingSpecialShulkerBoxColoring(_) => { - RecipeSerializer::CraftingSpecialShulkerboxcoloring - } - RecipeData::CraftingSpecialSuspiciousStew(_) => { - RecipeSerializer::CraftingSpecialSuspiciousstew - } - RecipeData::Smelting(_) => RecipeSerializer::Smelting, - RecipeData::Blasting(_) => RecipeSerializer::Blasting, - RecipeData::Smoking(_) => RecipeSerializer::Smoking, - RecipeData::CampfireCooking(_) => RecipeSerializer::CampfireCooking, - RecipeData::Stonecutting(_) => RecipeSerializer::Stonecutting, - RecipeData::SmithingTransform(_) => RecipeSerializer::SmithingTransform, - RecipeData::SmithingTrim(_) => RecipeSerializer::SmithingTrim, - RecipeData::CraftingDecoratedPot(_) => RecipeSerializer::CraftingDecoratedPot, - }; - let resource_location = ResourceLocation::new(&recipe_serializer.to_string()); - resource_location.write_into(buf)?; - self.identifier.write_into(buf)?; - self.data.write_without_id(buf)?; - Ok(()) - } -} - -impl McBufReadable for Recipe { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let recipe_serializer_name = ResourceLocation::read_from(buf)?; - let Ok(recipe_serializer) = RecipeSerializer::from_str(&recipe_serializer_name.to_string()) - else { - return Err(BufReadError::UnexpectedStringEnumVariant { - id: recipe_serializer_name.to_string(), - }); - }; - 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 = match recipe_serializer { - RecipeSerializer::CraftingShaped => { - RecipeData::CraftingShaped(ShapedRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingShapeless => { - RecipeData::CraftingShapeless(ShapelessRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialArmordye => { - RecipeData::CraftingSpecialArmorDye(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialBookcloning => { - RecipeData::CraftingSpecialBookCloning(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialMapcloning => { - RecipeData::CraftingSpecialMapCloning(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialMapextending => { - RecipeData::CraftingSpecialMapExtending(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialFireworkRocket => { - RecipeData::CraftingSpecialFireworkRocket(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialFireworkStar => { - RecipeData::CraftingSpecialFireworkStar(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialFireworkStarFade => { - RecipeData::CraftingSpecialFireworkStarFade(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialRepairitem => { - RecipeData::CraftingSpecialRepairItem(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialTippedarrow => { - RecipeData::CraftingSpecialTippedArrow(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialBannerduplicate => { - RecipeData::CraftingSpecialBannerDuplicate(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialShielddecoration => { - RecipeData::CraftingSpecialShieldDecoration(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialShulkerboxcoloring => { - RecipeData::CraftingSpecialShulkerBoxColoring(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingSpecialSuspiciousstew => { - RecipeData::CraftingSpecialSuspiciousStew(SimpleRecipe::read_from(buf)?) - } - RecipeSerializer::Smelting => RecipeData::Smelting(CookingRecipe::read_from(buf)?), - RecipeSerializer::Blasting => RecipeData::Blasting(CookingRecipe::read_from(buf)?), - RecipeSerializer::Smoking => RecipeData::Smoking(CookingRecipe::read_from(buf)?), - RecipeSerializer::CampfireCooking => { - RecipeData::CampfireCooking(CookingRecipe::read_from(buf)?) - } - RecipeSerializer::Stonecutting => { - RecipeData::Stonecutting(StoneCutterRecipe::read_from(buf)?) - } - RecipeSerializer::SmithingTransform => { - RecipeData::SmithingTransform(SmithingTransformRecipe::read_from(buf)?) - } - RecipeSerializer::SmithingTrim => { - RecipeData::SmithingTrim(SmithingTrimRecipe::read_from(buf)?) - } - RecipeSerializer::CraftingDecoratedPot => { - RecipeData::CraftingDecoratedPot(SimpleRecipe::read_from(buf)?) - } - }; - - let recipe = Recipe { identifier, data }; - - Ok(recipe) - } -} - #[cfg(test)] mod tests { use super::*; @@ -304,8 +161,8 @@ mod tests { #[test] fn test_crafting_shaped() { let mut buf = Vec::new(); - let recipe = Recipe { - identifier: ResourceLocation::new("minecraft:crafting_shaped"), + let recipe = RecipeHolder { + id: ResourceLocation::new("minecraft:crafting_shaped"), data: RecipeData::CraftingShaped(ShapedRecipe { group: String::new(), category: CraftingBookCategory::Building, @@ -332,15 +189,15 @@ mod tests { }), }; recipe.write_into(&mut buf).unwrap(); - let decoded_recipe = Recipe::read_from(&mut Cursor::new(&buf[..])).unwrap(); + let decoded_recipe = RecipeHolder::read_from(&mut Cursor::new(&buf[..])).unwrap(); assert_eq!(recipe, decoded_recipe); } #[test] fn test_crafting_shapeless() { let mut buf = Vec::new(); - let recipe = Recipe { - identifier: ResourceLocation::new("minecraft:crafting_shapeless"), + let recipe = RecipeHolder { + id: ResourceLocation::new("minecraft:crafting_shapeless"), data: RecipeData::CraftingShapeless(ShapelessRecipe { group: String::new(), category: CraftingBookCategory::Building, @@ -362,21 +219,21 @@ mod tests { }), }; recipe.write_into(&mut buf).unwrap(); - let decoded_recipe = Recipe::read_from(&mut Cursor::new(&buf[..])).unwrap(); + let decoded_recipe = RecipeHolder::read_from(&mut Cursor::new(&buf[..])).unwrap(); assert_eq!(recipe, decoded_recipe); } #[test] fn test_crafting_special_armordye() { let mut buf = Vec::new(); - let recipe = Recipe { - identifier: ResourceLocation::new("minecraft:crafting_special_armordye"), + let recipe = RecipeHolder { + id: ResourceLocation::new("minecraft:crafting_special_armordye"), data: RecipeData::CraftingSpecialArmorDye(SimpleRecipe { category: CraftingBookCategory::Building, }), }; recipe.write_into(&mut buf).unwrap(); - let decoded_recipe = Recipe::read_from(&mut Cursor::new(&buf[..])).unwrap(); + let decoded_recipe = RecipeHolder::read_from(&mut Cursor::new(&buf[..])).unwrap(); assert_eq!(recipe, decoded_recipe); } } diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index d45ea7b1..533dec8b 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -20,10 +20,12 @@ pub mod clientbound_container_close_packet; pub mod clientbound_container_set_content_packet; pub mod clientbound_container_set_data_packet; pub mod clientbound_container_set_slot_packet; +pub mod clientbound_cookie_request_packet; pub mod clientbound_cooldown_packet; pub mod clientbound_custom_chat_completions_packet; pub mod clientbound_custom_payload_packet; pub mod clientbound_damage_event_packet; +pub mod clientbound_debug_sample_packet; pub mod clientbound_delete_chat_packet; pub mod clientbound_disconnect_packet; pub mod clientbound_disguised_chat_packet; @@ -103,6 +105,7 @@ pub mod clientbound_sound_entity_packet; pub mod clientbound_sound_packet; pub mod clientbound_start_configuration_packet; pub mod clientbound_stop_sound_packet; +pub mod clientbound_store_cookie_packet; pub mod clientbound_system_chat_packet; pub mod clientbound_tab_list_packet; pub mod clientbound_tag_query_packet; @@ -110,16 +113,18 @@ 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_transfer_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 serverbound_accept_teleportation_packet; -pub mod serverbound_block_entity_tag_query; +pub mod serverbound_block_entity_tag_query_packet; pub mod serverbound_change_difficulty_packet; pub mod serverbound_chat_ack_packet; pub mod serverbound_chat_command_packet; +pub mod serverbound_chat_command_signed_packet; pub mod serverbound_chat_packet; pub mod serverbound_chat_session_update_packet; pub mod serverbound_chunk_batch_received_packet; @@ -131,9 +136,11 @@ 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_cookie_response_packet; pub mod serverbound_custom_payload_packet; +pub mod serverbound_debug_sample_subscription; pub mod serverbound_edit_book_packet; -pub mod serverbound_entity_tag_query; +pub mod serverbound_entity_tag_query_packet; pub mod serverbound_interact_packet; pub mod serverbound_jigsaw_generate_packet; pub mod serverbound_keep_alive_packet; @@ -177,60 +184,63 @@ declare_state_packets!( GamePacket, Serverbound => { 0x00: serverbound_accept_teleportation_packet::ServerboundAcceptTeleportationPacket, - 0x01: serverbound_block_entity_tag_query::ServerboundBlockEntityTagQuery, + 0x01: serverbound_block_entity_tag_query_packet::ServerboundBlockEntityTagQueryPacket, 0x02: serverbound_change_difficulty_packet::ServerboundChangeDifficultyPacket, 0x03: serverbound_chat_ack_packet::ServerboundChatAckPacket, 0x04: serverbound_chat_command_packet::ServerboundChatCommandPacket, - 0x05: serverbound_chat_packet::ServerboundChatPacket, - 0x06: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket, - 0x07: serverbound_chunk_batch_received_packet::ServerboundChunkBatchReceivedPacket, - 0x08: serverbound_client_command_packet::ServerboundClientCommandPacket, - 0x09: serverbound_client_information_packet::ServerboundClientInformationPacket, - 0x0a: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket, - 0x0b: serverbound_configuration_acknowledged_packet::ServerboundConfigurationAcknowledgedPacket, - 0x0c: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket, - 0x0d: serverbound_container_click_packet::ServerboundContainerClickPacket, - 0x0e: serverbound_container_close_packet::ServerboundContainerClosePacket, - 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, + 0x05: serverbound_chat_command_signed_packet::ServerboundChatCommandSignedPacket, + 0x06: serverbound_chat_packet::ServerboundChatPacket, + 0x07: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket, + 0x08: serverbound_chunk_batch_received_packet::ServerboundChunkBatchReceivedPacket, + 0x09: serverbound_client_command_packet::ServerboundClientCommandPacket, + 0x0a: serverbound_client_information_packet::ServerboundClientInformationPacket, + 0x0b: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket, + 0x0c: serverbound_configuration_acknowledged_packet::ServerboundConfigurationAcknowledgedPacket, + 0x0d: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket, + 0x0e: serverbound_container_click_packet::ServerboundContainerClickPacket, + 0x0f: serverbound_container_close_packet::ServerboundContainerClosePacket, + 0x10: serverbound_container_slot_state_changed_packet::ServerboundContainerSlotStateChangedPacket, + 0x11: serverbound_cookie_response_packet::ServerboundCookieResponsePacket, + 0x12: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, + 0x13: serverbound_debug_sample_subscription::ServerboundDebugSampleSubscription, + 0x14: serverbound_edit_book_packet::ServerboundEditBookPacket, + 0x15: serverbound_entity_tag_query_packet::ServerboundEntityTagQueryPacket, + 0x16: serverbound_interact_packet::ServerboundInteractPacket, + 0x17: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket, + 0x18: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, + 0x19: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket, + 0x1a: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, + 0x1b: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket, + 0x1c: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, + 0x1d: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, + 0x1e: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket, + 0x1f: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket, + 0x20: serverbound_pick_item_packet::ServerboundPickItemPacket, + 0x21: serverbound_ping_request_packet::ServerboundPingRequestPacket, + 0x22: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket, + 0x23: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket, + 0x24: serverbound_player_action_packet::ServerboundPlayerActionPacket, + 0x25: serverbound_player_command_packet::ServerboundPlayerCommandPacket, + 0x26: serverbound_player_input_packet::ServerboundPlayerInputPacket, + 0x27: serverbound_pong_packet::ServerboundPongPacket, + 0x28: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket, + 0x29: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket, + 0x2a: serverbound_rename_item_packet::ServerboundRenameItemPacket, + 0x2b: serverbound_resource_pack_packet::ServerboundResourcePackPacket, + 0x2c: serverbound_seen_advancements_packet::ServerboundSeenAdvancementsPacket, + 0x2d: serverbound_select_trade_packet::ServerboundSelectTradePacket, + 0x2e: serverbound_set_beacon_packet::ServerboundSetBeaconPacket, + 0x2f: serverbound_set_carried_item_packet::ServerboundSetCarriedItemPacket, + 0x30: serverbound_set_command_block_packet::ServerboundSetCommandBlockPacket, + 0x31: serverbound_set_command_minecart_packet::ServerboundSetCommandMinecartPacket, + 0x32: serverbound_set_creative_mode_slot_packet::ServerboundSetCreativeModeSlotPacket, + 0x33: serverbound_set_jigsaw_block_packet::ServerboundSetJigsawBlockPacket, + 0x34: serverbound_set_structure_block_packet::ServerboundSetStructureBlockPacket, + 0x35: serverbound_sign_update_packet::ServerboundSignUpdatePacket, + 0x36: serverbound_swing_packet::ServerboundSwingPacket, + 0x37: serverbound_teleport_to_entity_packet::ServerboundTeleportToEntityPacket, + 0x38: serverbound_use_item_on_packet::ServerboundUseItemOnPacket, + 0x39: serverbound_use_item_packet::ServerboundUseItemPacket, }, Clientbound => { 0x00: clientbound_bundle_packet::ClientboundBundlePacket, @@ -255,100 +265,104 @@ declare_state_packets!( 0x13: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket, 0x14: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket, 0x15: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket, - 0x16: clientbound_cooldown_packet::ClientboundCooldownPacket, - 0x17: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket, - 0x18: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, - 0x19: clientbound_damage_event_packet::ClientboundDamageEventPacket, - 0x1a: clientbound_delete_chat_packet::ClientboundDeleteChatPacket, - 0x1b: clientbound_disconnect_packet::ClientboundDisconnectPacket, - 0x1c: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket, - 0x1d: clientbound_entity_event_packet::ClientboundEntityEventPacket, - 0x1e: clientbound_explode_packet::ClientboundExplodePacket, - 0x1f: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket, - 0x20: clientbound_game_event_packet::ClientboundGameEventPacket, - 0x21: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket, - 0x22: clientbound_hurt_animation_packet::ClientboundHurtAnimationPacket, - 0x23: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket, - 0x24: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, - 0x25: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, - 0x26: clientbound_level_event_packet::ClientboundLevelEventPacket, - 0x27: clientbound_level_particles_packet::ClientboundLevelParticlesPacket, - 0x28: clientbound_light_update_packet::ClientboundLightUpdatePacket, - 0x29: clientbound_login_packet::ClientboundLoginPacket, - 0x2a: clientbound_map_item_data_packet::ClientboundMapItemDataPacket, - 0x2b: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket, - 0x2c: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket, - 0x2d: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket, - 0x2e: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket, - 0x2f: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket, - 0x30: clientbound_open_book_packet::ClientboundOpenBookPacket, - 0x31: clientbound_open_screen_packet::ClientboundOpenScreenPacket, - 0x32: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket, - 0x33: clientbound_ping_packet::ClientboundPingPacket, - 0x34: clientbound_pong_response_packet::ClientboundPongResponsePacket, - 0x35: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket, - 0x36: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket, - 0x37: clientbound_player_chat_packet::ClientboundPlayerChatPacket, - 0x38: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket, - 0x39: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket, - 0x3a: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket, - 0x3b: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket, - 0x3c: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket, - 0x3d: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket, - 0x3e: clientbound_player_position_packet::ClientboundPlayerPositionPacket, - 0x3f: clientbound_recipe_packet::ClientboundRecipePacket, - 0x40: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket, - 0x41: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket, - 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, + 0x16: clientbound_cookie_request_packet::ClientboundCookieRequestPacket, + 0x17: clientbound_cooldown_packet::ClientboundCooldownPacket, + 0x18: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket, + 0x19: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, + 0x1a: clientbound_damage_event_packet::ClientboundDamageEventPacket, + 0x1b: clientbound_debug_sample_packet::ClientboundDebugSamplePacket, + 0x1c: clientbound_delete_chat_packet::ClientboundDeleteChatPacket, + 0x1d: clientbound_disconnect_packet::ClientboundDisconnectPacket, + 0x1e: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket, + 0x1f: clientbound_entity_event_packet::ClientboundEntityEventPacket, + 0x20: clientbound_explode_packet::ClientboundExplodePacket, + 0x21: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket, + 0x22: clientbound_game_event_packet::ClientboundGameEventPacket, + 0x23: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket, + 0x24: clientbound_hurt_animation_packet::ClientboundHurtAnimationPacket, + 0x25: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket, + 0x26: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, + 0x27: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, + 0x28: clientbound_level_event_packet::ClientboundLevelEventPacket, + 0x29: clientbound_level_particles_packet::ClientboundLevelParticlesPacket, + 0x2a: clientbound_light_update_packet::ClientboundLightUpdatePacket, + 0x2b: clientbound_login_packet::ClientboundLoginPacket, + 0x2c: clientbound_map_item_data_packet::ClientboundMapItemDataPacket, + 0x2d: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket, + 0x2e: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket, + 0x2f: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket, + 0x30: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket, + 0x31: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket, + 0x32: clientbound_open_book_packet::ClientboundOpenBookPacket, + 0x33: clientbound_open_screen_packet::ClientboundOpenScreenPacket, + 0x34: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket, + 0x35: clientbound_ping_packet::ClientboundPingPacket, + 0x36: clientbound_pong_response_packet::ClientboundPongResponsePacket, + 0x37: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket, + 0x38: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket, + 0x39: clientbound_player_chat_packet::ClientboundPlayerChatPacket, + 0x3a: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket, + 0x3b: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket, + 0x3c: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket, + 0x3d: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket, + 0x3e: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket, + 0x3f: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket, + 0x40: clientbound_player_position_packet::ClientboundPlayerPositionPacket, + 0x41: clientbound_recipe_packet::ClientboundRecipePacket, + 0x42: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket, + 0x43: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket, + 0x44: clientbound_reset_score_packet::ClientboundResetScorePacket, + 0x45: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket, + 0x46: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket, + 0x47: clientbound_respawn_packet::ClientboundRespawnPacket, + 0x48: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, + 0x49: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, + 0x4a: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket, + 0x4b: clientbound_server_data_packet::ClientboundServerDataPacket, + 0x4c: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket, + 0x4d: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket, + 0x4e: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket, + 0x4f: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket, + 0x50: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket, + 0x51: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket, + 0x52: clientbound_set_camera_packet::ClientboundSetCameraPacket, + 0x53: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket, + 0x54: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, + 0x55: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket, + 0x56: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, + 0x57: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket, + 0x58: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, + 0x59: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, + 0x5a: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket, + 0x5b: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, + 0x5c: clientbound_set_experience_packet::ClientboundSetExperiencePacket, + 0x5d: clientbound_set_health_packet::ClientboundSetHealthPacket, + 0x5e: clientbound_set_objective_packet::ClientboundSetObjectivePacket, + 0x5f: clientbound_set_passengers_packet::ClientboundSetPassengersPacket, + 0x60: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket, + 0x61: clientbound_set_score_packet::ClientboundSetScorePacket, + 0x62: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket, + 0x63: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket, + 0x64: clientbound_set_time_packet::ClientboundSetTimePacket, + 0x65: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket, + 0x66: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket, + 0x67: clientbound_sound_entity_packet::ClientboundSoundEntityPacket, + 0x68: clientbound_sound_packet::ClientboundSoundPacket, + 0x69: clientbound_start_configuration_packet::ClientboundStartConfigurationPacket, + 0x6a: clientbound_stop_sound_packet::ClientboundStopSoundPacket, + 0x6b: clientbound_store_cookie_packet::ClientboundStoreCookiePacket, + 0x6c: clientbound_system_chat_packet::ClientboundSystemChatPacket, + 0x6d: clientbound_tab_list_packet::ClientboundTabListPacket, + 0x6e: clientbound_tag_query_packet::ClientboundTagQueryPacket, + 0x6f: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket, + 0x70: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, + 0x71: clientbound_ticking_state_packet::ClientboundTickingStatePacket, + 0x72: clientbound_ticking_step_packet::ClientboundTickingStepPacket, + 0x73: clientbound_transfer_packet::ClientboundTransferPacket, + 0x74: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, + 0x75: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, + 0x76: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, + 0x77: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, + 0x78: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, } ); diff --git a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs b/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs new file mode 100644 index 00000000..d8856647 --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs @@ -0,0 +1,10 @@ +use azalea_buf::McBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +pub struct ServerboundBlockEntityTagQueryPacket { + #[var] + pub transaction_id: u32, + pub pos: BlockPos, +} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs new file mode 100755 index 00000000..bb814d55 --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs @@ -0,0 +1,19 @@ +use super::serverbound_chat_packet::LastSeenMessagesUpdate; +use azalea_buf::McBuf; +use azalea_crypto::MessageSignature; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +pub struct ServerboundChatCommandSignedPacket { + pub command: String, + pub timestamp: u64, + pub salt: u64, + pub argument_signatures: Vec<ArgumentSignature>, + pub last_seen_messages: LastSeenMessagesUpdate, +} + +#[derive(Clone, Debug, McBuf)] +pub struct ArgumentSignature { + pub name: String, + pub signature: MessageSignature, +} diff --git a/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs b/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs new file mode 100644 index 00000000..8ad0f07e --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +pub struct ServerboundCookieResponsePacket { + pub key: ResourceLocation, + pub payload: Option<Vec<u8>>, +} diff --git a/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs b/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs new file mode 100755 index 00000000..236972e0 --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs @@ -0,0 +1,12 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +pub struct ServerboundDebugSampleSubscription { + pub sample_type: RemoteDebugSampleType, +} + +#[derive(Clone, Copy, Debug, McBuf)] +pub enum RemoteDebugSampleType { + TickTime, +} diff --git a/azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs b/azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs new file mode 100644 index 00000000..d40a59a6 --- /dev/null +++ b/azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs @@ -0,0 +1,10 @@ +use azalea_buf::McBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +pub struct ServerboundEntityTagQueryPacket { + #[var] + pub transaction_id: u32, + #[var] + pub entity_id: u32, +} diff --git a/azalea-protocol/src/packets/login/clientbound_cookie_request_packet.rs b/azalea-protocol/src/packets/login/clientbound_cookie_request_packet.rs new file mode 100755 index 00000000..27ea0c09 --- /dev/null +++ b/azalea-protocol/src/packets/login/clientbound_cookie_request_packet.rs @@ -0,0 +1,8 @@ +use azalea_buf::McBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundLoginPacket; + +#[derive(Clone, Debug, McBuf, ClientboundLoginPacket)] +pub struct ClientboundCookieRequestPacket { + pub key: FormattedText, +} 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 2783159a..51f486d0 100755 --- a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs @@ -5,4 +5,5 @@ use azalea_protocol_macros::ClientboundLoginPacket; #[derive(Clone, Debug, McBuf, ClientboundLoginPacket)] pub struct ClientboundGameProfilePacket { pub game_profile: GameProfile, + pub strict_error_handling: bool, } diff --git a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs index 0d5cce7d..9beb499c 100755 --- a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs @@ -7,5 +7,6 @@ pub struct ClientboundHelloPacket { // #[len(20)] pub server_id: String, pub public_key: Vec<u8>, - pub nonce: Vec<u8>, + pub challenge: Vec<u8>, + pub should_authenticate: bool, } diff --git a/azalea-protocol/src/packets/login/mod.rs b/azalea-protocol/src/packets/login/mod.rs index f9bf8dad..2037f2c1 100755 --- a/azalea-protocol/src/packets/login/mod.rs +++ b/azalea-protocol/src/packets/login/mod.rs @@ -1,8 +1,10 @@ +pub mod clientbound_cookie_request_packet; pub mod clientbound_custom_query_packet; pub mod clientbound_game_profile_packet; pub mod clientbound_hello_packet; pub mod clientbound_login_compression_packet; pub mod clientbound_login_disconnect_packet; +pub mod serverbound_cookie_response_packet; pub mod serverbound_custom_query_answer_packet; pub mod serverbound_hello_packet; pub mod serverbound_key_packet; @@ -17,6 +19,7 @@ declare_state_packets!( 0x01: serverbound_key_packet::ServerboundKeyPacket, 0x02: serverbound_custom_query_answer_packet::ServerboundCustomQueryAnswerPacket, 0x03: serverbound_login_acknowledged_packet::ServerboundLoginAcknowledgedPacket, + 0x04: serverbound_cookie_response_packet::ServerboundCookieResponsePacket, }, Clientbound => { 0x00: clientbound_login_disconnect_packet::ClientboundLoginDisconnectPacket, @@ -24,5 +27,6 @@ declare_state_packets!( 0x02: clientbound_game_profile_packet::ClientboundGameProfilePacket, 0x03: clientbound_login_compression_packet::ClientboundLoginCompressionPacket, 0x04: clientbound_custom_query_packet::ClientboundCustomQueryPacket, + 0x05: clientbound_cookie_request_packet::ClientboundCookieRequestPacket, } ); diff --git a/azalea-protocol/src/packets/login/serverbound_cookie_response_packet.rs b/azalea-protocol/src/packets/login/serverbound_cookie_response_packet.rs new file mode 100755 index 00000000..2074e2e7 --- /dev/null +++ b/azalea-protocol/src/packets/login/serverbound_cookie_response_packet.rs @@ -0,0 +1,9 @@ +use azalea_buf::McBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundLoginPacket; + +#[derive(Clone, Debug, McBuf, ServerboundLoginPacket)] +pub struct ServerboundCookieResponsePacket { + pub key: ResourceLocation, + pub payload: Option<Vec<u8>>, +} diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index 4bb4b7de..63a0c1c9 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 = 765; +pub const PROTOCOL_VERSION: i32 = 766; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { |
