diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2024-11-27 19:31:40 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-27 19:31:40 -0600 |
| commit | 08958c2278b15ebeac8a964f392ebb792e479b61 (patch) | |
| tree | 4ae3664cea38d7fd1a8f1e95ed06fac04ffe519e /azalea-protocol/src/packets/game | |
| parent | 139d77d3c2b0922fba5e9d4fa2bd9819d78bd773 (diff) | |
| download | azalea-drasl-08958c2278b15ebeac8a964f392ebb792e479b61.tar.xz | |
Refactor azalea-protocol (#190)
* start updating to 1.21.4
* fix block codegen and stop using block data from burger
* rename packet related modules and structs to be simpler
* ItemSlot -> ItemStack for more consistency with mojmap
* .get() -> .into_packet()
* simplify declare_state_packets by removing packet ids
* rename read_from and write_into to azalea_read and azalea_write
* rename McBufReadable and McBufWritable to AzaleaRead and AzaleaWrite
* McBuf -> AzBuf
* remove most uses of into_variant
* update codegen and use resourcelocation names for packets
* implement #[limit(i)] attribute for AzBuf derive macro
* fixes for 1.21.4
* fix examples
* update some physics code and fix ChatType
* remove unused imports in codegen
* re-add some things to migrate.py and update +mc version numbers automatically
* downgrade to 1.21.3 lol
Diffstat (limited to 'azalea-protocol/src/packets/game')
288 files changed, 2096 insertions, 2360 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs b/azalea-protocol/src/packets/game/c_add_entity.rs index 6b62df19..cf0adeb7 100755 --- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs +++ b/azalea-protocol/src/packets/game/c_add_entity.rs @@ -1,11 +1,11 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::{position::Vec3, resource_location::ResourceLocation}; use azalea_entity::{metadata::apply_default_metadata, EntityBundle}; use azalea_protocol_macros::ClientboundGamePacket; use uuid::Uuid; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAddEntityPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAddEntity { /// The id of the entity. #[var] pub id: u32, @@ -22,7 +22,7 @@ pub struct ClientboundAddEntityPacket { pub z_vel: i16, } -impl ClientboundAddEntityPacket { +impl ClientboundAddEntity { /// Make the entity into a bundle that can be inserted into the ECS. You /// must apply the metadata after inserting the bundle with /// [`Self::apply_metadata`]. diff --git a/azalea-protocol/src/packets/game/clientbound_add_experience_orb_packet.rs b/azalea-protocol/src/packets/game/c_add_experience_orb.rs index 84edcae6..b3d12858 100755 --- a/azalea-protocol/src/packets/game/clientbound_add_experience_orb_packet.rs +++ b/azalea-protocol/src/packets/game/c_add_experience_orb.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAddExperienceOrbPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAddExperienceOrb { #[var] pub id: u32, pub x: f64, diff --git a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs b/azalea-protocol/src/packets/game/c_add_player.rs index 45ab4584..7b36567d 100755 --- a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs +++ b/azalea-protocol/src/packets/game/c_add_player.rs @@ -1,4 +1,4 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::{ResourceLocation, Vec3}; use azalea_entity::{metadata::PlayerMetadataBundle, EntityBundle, PlayerBundle}; use azalea_protocol_macros::ClientboundGamePacket; @@ -7,8 +7,8 @@ use uuid::Uuid; /// This packet is sent by the server when a player comes into visible range, /// not when a player joins. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAddPlayerPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAddPlayer { #[var] pub id: u32, pub uuid: Uuid, @@ -17,7 +17,7 @@ pub struct ClientboundAddPlayerPacket { pub y_rot: i8, } -impl ClientboundAddPlayerPacket { +impl ClientboundAddPlayer { pub fn as_player_bundle(&self, world_name: ResourceLocation) -> PlayerBundle { PlayerBundle { entity: EntityBundle::new(self.uuid, self.position, EntityKind::Player, world_name), diff --git a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs b/azalea-protocol/src/packets/game/c_animate.rs index 8c99b1b7..bda0b152 100755 --- a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs +++ b/azalea-protocol/src/packets/game/c_animate.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAnimatePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAnimate { #[var] pub id: u32, pub action: AnimationAction, @@ -10,7 +10,7 @@ pub struct ClientboundAnimatePacket { // minecraft actually uses a u8 for this, but a varint still works and makes it // so i don't have to add a special handler -#[derive(Clone, Debug, Copy, McBuf)] +#[derive(Clone, Debug, Copy, AzBuf)] pub enum AnimationAction { SwingMainHand = 0, Hurt = 1, diff --git a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs b/azalea-protocol/src/packets/game/c_award_stats.rs index 32e2c8aa..20f8b1e0 100755 --- a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs +++ b/azalea-protocol/src/packets/game/c_award_stats.rs @@ -1,15 +1,15 @@ use std::collections::HashMap; -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAwardStatsPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAwardStats { #[var] pub stats: HashMap<Stat, i32>, } -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, McBuf)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, AzBuf)] pub enum Stat { Mined(azalea_registry::Block), Crafted(azalea_registry::Item), diff --git a/azalea-protocol/src/packets/game/c_block_changed_ack.rs b/azalea-protocol/src/packets/game/c_block_changed_ack.rs new file mode 100755 index 00000000..ebb303c0 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_block_changed_ack.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockChangedAck { + #[var] + pub sequence: i32, +} diff --git a/azalea-protocol/src/packets/game/clientbound_block_destruction_packet.rs b/azalea-protocol/src/packets/game/c_block_destruction.rs index 130c698e..50d8085b 100755 --- a/azalea-protocol/src/packets/game/clientbound_block_destruction_packet.rs +++ b/azalea-protocol/src/packets/game/c_block_destruction.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockDestructionPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockDestruction { /// The ID of the entity breaking the block. #[var] pub id: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs b/azalea-protocol/src/packets/game/c_block_entity_data.rs index 3406a75f..82ba60de 100755 --- a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs +++ b/azalea-protocol/src/packets/game/c_block_entity_data.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; use simdnbt::owned::Nbt; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockEntityDataPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockEntityData { pub pos: BlockPos, pub block_entity_type: azalea_registry::BlockEntityKind, pub tag: Nbt, diff --git a/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs b/azalea-protocol/src/packets/game/c_block_event.rs index 86f57b97..3a71b186 100755 --- a/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs +++ b/azalea-protocol/src/packets/game/c_block_event.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::Block; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockEventPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockEvent { pub pos: BlockPos, pub action_id: u8, pub action_parameter: u8, diff --git a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs b/azalea-protocol/src/packets/game/c_block_update.rs index c1869e74..ae9bd998 100755 --- a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs +++ b/azalea-protocol/src/packets/game/c_block_update.rs @@ -1,10 +1,10 @@ use azalea_block::BlockState; -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockUpdatePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockUpdate { pub pos: BlockPos, pub block_state: BlockState, } diff --git a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs b/azalea-protocol/src/packets/game/c_boss_event.rs index 65240edf..e54ab59f 100755 --- a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs +++ b/azalea-protocol/src/packets/game/c_boss_event.rs @@ -1,16 +1,14 @@ use std::io::Cursor; use std::io::Write; -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_chat::FormattedText; use azalea_core::bitset::FixedBitSet; use azalea_protocol_macros::ClientboundGamePacket; use uuid::Uuid; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBossEventPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBossEvent { pub id: Uuid, pub operation: Operation, } @@ -25,16 +23,16 @@ pub enum Operation { UpdateProperties(Properties), } -impl McBufReadable for Operation { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let operation_id = u32::var_read_from(buf)?; +impl AzaleaRead for Operation { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let operation_id = u32::azalea_read_var(buf)?; Ok(match operation_id { - 0 => Operation::Add(AddOperation::read_from(buf)?), + 0 => Operation::Add(AddOperation::azalea_read(buf)?), 1 => Operation::Remove, - 2 => Operation::UpdateProgress(f32::read_from(buf)?), - 3 => Operation::UpdateName(FormattedText::read_from(buf)?), - 4 => Operation::UpdateStyle(Style::read_from(buf)?), - 5 => Operation::UpdateProperties(Properties::read_from(buf)?), + 2 => Operation::UpdateProgress(f32::azalea_read(buf)?), + 3 => Operation::UpdateName(FormattedText::azalea_read(buf)?), + 4 => Operation::UpdateStyle(Style::azalea_read(buf)?), + 5 => Operation::UpdateProperties(Properties::azalea_read(buf)?), _ => { return Err(BufReadError::UnexpectedEnumVariant { id: operation_id as i32, @@ -44,38 +42,38 @@ impl McBufReadable for Operation { } } -impl McBufWritable for Operation { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for Operation { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { match self { Operation::Add(add) => { - 0u32.var_write_into(buf)?; - add.write_into(buf)?; + 0u32.azalea_write_var(buf)?; + add.azalea_write(buf)?; } Operation::Remove => { - 1u32.var_write_into(buf)?; + 1u32.azalea_write_var(buf)?; } Operation::UpdateProgress(progress) => { - 2u32.var_write_into(buf)?; - progress.write_into(buf)?; + 2u32.azalea_write_var(buf)?; + progress.azalea_write(buf)?; } Operation::UpdateName(name) => { - 3u32.var_write_into(buf)?; - name.write_into(buf)?; + 3u32.azalea_write_var(buf)?; + name.azalea_write(buf)?; } Operation::UpdateStyle(style) => { - 4u32.var_write_into(buf)?; - style.write_into(buf)?; + 4u32.azalea_write_var(buf)?; + style.azalea_write(buf)?; } Operation::UpdateProperties(properties) => { - 5u32.var_write_into(buf)?; - properties.write_into(buf)?; + 5u32.azalea_write_var(buf)?; + properties.azalea_write(buf)?; } } Ok(()) } } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct AddOperation { pub name: FormattedText, pub progress: f32, @@ -83,13 +81,13 @@ pub struct AddOperation { pub properties: Properties, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct Style { pub color: BossBarColor, pub overlay: BossBarOverlay, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum BossBarColor { Pink = 0, Blue = 1, @@ -100,7 +98,7 @@ pub enum BossBarColor { White = 6, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum BossBarOverlay { Progress = 0, Notched6 = 1, @@ -116,9 +114,9 @@ pub struct Properties { pub create_world_fog: bool, } -impl McBufReadable for Properties { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let set = FixedBitSet::<3>::read_from(buf)?; +impl AzaleaRead for Properties { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let set = FixedBitSet::<3>::azalea_read(buf)?; Ok(Self { darken_screen: set.index(0), play_music: set.index(1), @@ -127,8 +125,8 @@ impl McBufReadable for Properties { } } -impl McBufWritable for Properties { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for Properties { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<3>::new(); if self.darken_screen { set.set(0); @@ -139,7 +137,7 @@ impl McBufWritable for Properties { if self.create_world_fog { set.set(2); } - set.write_into(buf)?; + set.azalea_write(buf)?; Ok(()) } } diff --git a/azalea-protocol/src/packets/game/c_bundle_delimiter.rs b/azalea-protocol/src/packets/game/c_bundle_delimiter.rs new file mode 100644 index 00000000..cda33d1b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_bundle_delimiter.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBundleDelimiter; diff --git a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs b/azalea-protocol/src/packets/game/c_change_difficulty.rs index e7dafbeb..cdcc4792 100755 --- a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs +++ b/azalea-protocol/src/packets/game/c_change_difficulty.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::difficulty::Difficulty; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChangeDifficultyPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChangeDifficulty { pub difficulty: Difficulty, pub locked: bool, } diff --git a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs b/azalea-protocol/src/packets/game/c_chat_preview.rs index 40f28259..e0ddd2ec 100755 --- a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs +++ b/azalea-protocol/src/packets/game/c_chat_preview.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChatPreviewPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChatPreview { pub query_id: i32, pub preview: Option<FormattedText>, } diff --git a/azalea-protocol/src/packets/game/c_chunk_batch_finished.rs b/azalea-protocol/src/packets/game/c_chunk_batch_finished.rs new file mode 100644 index 00000000..c419888b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_chunk_batch_finished.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChunkBatchFinished { + #[var] + pub batch_size: u32, +} diff --git a/azalea-protocol/src/packets/game/c_chunk_batch_start.rs b/azalea-protocol/src/packets/game/c_chunk_batch_start.rs new file mode 100644 index 00000000..8b0555dc --- /dev/null +++ b/azalea-protocol/src/packets/game/c_chunk_batch_start.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChunkBatchStart {} diff --git a/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs b/azalea-protocol/src/packets/game/c_chunks_biomes.rs index 7c8f2154..a8e65af4 100644 --- a/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs +++ b/azalea-protocol/src/packets/game/c_chunks_biomes.rs @@ -1,13 +1,13 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::ChunkPos; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChunksBiomesPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChunksBiomes { pub chunk_biome_data: Vec<ChunkBiomeData>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct ChunkBiomeData { pub pos: ChunkPos, pub buffer: Vec<u8>, diff --git a/azalea-protocol/src/packets/game/c_clear_titles.rs b/azalea-protocol/src/packets/game/c_clear_titles.rs new file mode 100644 index 00000000..58b67bad --- /dev/null +++ b/azalea-protocol/src/packets/game/c_clear_titles.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundClearTitles { + pub reset_times: bool, +} diff --git a/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs b/azalea-protocol/src/packets/game/c_command_suggestions.rs index c9752ee9..37679a72 100755 --- a/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs +++ b/azalea-protocol/src/packets/game/c_command_suggestions.rs @@ -1,9 +1,9 @@ use azalea_brigadier::suggestion::Suggestions; -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCommandSuggestionsPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCommandSuggestions { #[var] pub id: u32, pub suggestions: Suggestions, @@ -14,7 +14,7 @@ mod tests { use std::io::Cursor; use azalea_brigadier::{context::StringRange, suggestion::Suggestion}; - use azalea_buf::{McBufReadable, McBufWritable}; + use azalea_buf::{AzaleaRead, AzaleaWrite}; use super::*; @@ -29,9 +29,9 @@ mod tests { )], ); let mut buf = Vec::new(); - suggestions.write_into(&mut buf).unwrap(); + suggestions.azalea_write(&mut buf).unwrap(); let mut cursor = Cursor::new(&buf[..]); - let suggestions = Suggestions::read_from(&mut cursor).unwrap(); + let suggestions = Suggestions::azalea_read(&mut cursor).unwrap(); assert_eq!(suggestions, suggestions); } } diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/c_commands.rs index 10055e37..1a231559 100755 --- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs +++ b/azalea-protocol/src/packets/game/c_commands.rs @@ -1,14 +1,12 @@ use std::io::{Cursor, Write}; -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; use azalea_protocol_macros::ClientboundGamePacket; use tracing::warn; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCommandsPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCommands { pub entries: Vec<BrigadierNodeStub>, #[var] pub root_index: u32, @@ -46,24 +44,24 @@ impl<T: PartialEq> PartialEq for BrigadierNumber<T> { } } -impl<T: McBufReadable> McBufReadable for BrigadierNumber<T> { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let flags = FixedBitSet::<2>::read_from(buf)?; +impl<T: AzaleaRead> AzaleaRead for BrigadierNumber<T> { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let flags = FixedBitSet::<2>::azalea_read(buf)?; let min = if flags.index(0) { - Some(T::read_from(buf)?) + Some(T::azalea_read(buf)?) } else { None }; let max = if flags.index(1) { - Some(T::read_from(buf)?) + Some(T::azalea_read(buf)?) } else { None }; Ok(BrigadierNumber { min, max }) } } -impl<T: McBufWritable> McBufWritable for BrigadierNumber<T> { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl<T: AzaleaWrite> AzaleaWrite for BrigadierNumber<T> { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut flags = FixedBitSet::<2>::new(); if self.min.is_some() { flags.set(0); @@ -71,18 +69,18 @@ impl<T: McBufWritable> McBufWritable for BrigadierNumber<T> { if self.max.is_some() { flags.set(1); } - flags.write_into(buf)?; + flags.azalea_write(buf)?; if let Some(min) = &self.min { - min.write_into(buf)?; + min.azalea_write(buf)?; } if let Some(max) = &self.max { - max.write_into(buf)?; + max.azalea_write(buf)?; } Ok(()) } } -#[derive(Debug, Clone, Copy, McBuf, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, AzBuf, PartialEq, Eq)] pub enum BrigadierString { /// Reads a single word SingleWord = 0, @@ -93,7 +91,7 @@ pub enum BrigadierString { GreedyPhrase = 2, } -#[derive(Debug, Clone, McBuf, PartialEq)] +#[derive(Debug, Clone, AzBuf, PartialEq)] pub enum BrigadierParser { Bool, Float(BrigadierNumber<f32>), @@ -156,17 +154,17 @@ pub struct EntityParser { pub single: bool, pub players_only: bool, } -impl McBufReadable for EntityParser { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let flags = FixedBitSet::<2>::read_from(buf)?; +impl AzaleaRead for EntityParser { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let flags = FixedBitSet::<2>::azalea_read(buf)?; Ok(EntityParser { single: flags.index(0), players_only: flags.index(1), }) } } -impl McBufWritable for EntityParser { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for EntityParser { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut flags = FixedBitSet::<2>::new(); if self.single { flags.set(0); @@ -174,15 +172,15 @@ impl McBufWritable for EntityParser { if self.players_only { flags.set(1); } - flags.write_into(buf)?; + flags.azalea_write(buf)?; Ok(()) } } // TODO: BrigadierNodeStub should have more stuff -impl McBufReadable for BrigadierNodeStub { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let flags = FixedBitSet::<8>::read_from(buf)?; +impl AzaleaRead for BrigadierNodeStub { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let flags = FixedBitSet::<8>::azalea_read(buf)?; if flags.index(5) || flags.index(6) || flags.index(7) { warn!("Warning: The flags from a Brigadier node are over 31. This is probably a bug.",); } @@ -192,19 +190,19 @@ impl McBufReadable for BrigadierNodeStub { let has_redirect = flags.index(3); let has_suggestions_type = flags.index(4); - let children = Vec::<u32>::var_read_from(buf)?; + let children = Vec::<u32>::azalea_read_var(buf)?; let redirect_node = if has_redirect { - Some(u32::var_read_from(buf)?) + Some(u32::azalea_read_var(buf)?) } else { None }; // argument node if node_type == 2 { - let name = String::read_from(buf)?; - let parser = BrigadierParser::read_from(buf)?; + let name = String::azalea_read(buf)?; + let parser = BrigadierParser::azalea_read(buf)?; let suggestions_type = if has_suggestions_type { - Some(ResourceLocation::read_from(buf)?) + Some(ResourceLocation::azalea_read(buf)?) } else { None }; @@ -222,7 +220,7 @@ impl McBufReadable for BrigadierNodeStub { } // literal node else if node_type == 1 { - let name = String::read_from(buf)?; + let name = String::azalea_read(buf)?; return Ok(BrigadierNodeStub { is_executable, children, @@ -239,8 +237,8 @@ impl McBufReadable for BrigadierNodeStub { } } -impl McBufWritable for BrigadierNodeStub { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for BrigadierNodeStub { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut flags = FixedBitSet::<4>::new(); if self.is_executable { flags.set(2); @@ -251,25 +249,25 @@ impl McBufWritable for BrigadierNodeStub { match &self.node_type { NodeType::Root => { - flags.write_into(buf)?; + flags.azalea_write(buf)?; - self.children.var_write_into(buf)?; + self.children.azalea_write_var(buf)?; if let Some(redirect) = self.redirect_node { - redirect.var_write_into(buf)?; + redirect.azalea_write_var(buf)?; } } NodeType::Literal { name } => { flags.set(0); - flags.write_into(buf)?; + flags.azalea_write(buf)?; - self.children.var_write_into(buf)?; + self.children.azalea_write_var(buf)?; if let Some(redirect) = self.redirect_node { - redirect.var_write_into(buf)?; + redirect.azalea_write_var(buf)?; } - name.write_into(buf)?; + name.azalea_write(buf)?; } NodeType::Argument { name, @@ -280,19 +278,19 @@ impl McBufWritable for BrigadierNodeStub { if suggestions_type.is_some() { flags.set(4); } - flags.write_into(buf)?; + flags.azalea_write(buf)?; - self.children.var_write_into(buf)?; + self.children.azalea_write_var(buf)?; if let Some(redirect) = self.redirect_node { - redirect.var_write_into(buf)?; + redirect.azalea_write_var(buf)?; } - name.write_into(buf)?; - parser.write_into(buf)?; + name.azalea_write(buf)?; + parser.azalea_write(buf)?; if let Some(suggestion) = suggestions_type { - suggestion.write_into(buf)?; + suggestion.azalea_write(buf)?; } } } @@ -336,9 +334,9 @@ mod tests { node_type: NodeType::Root, }; let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); + data.azalea_write(&mut buf).unwrap(); let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = BrigadierNodeStub::read_from(&mut data_cursor).unwrap(); + let read_data = BrigadierNodeStub::azalea_read(&mut data_cursor).unwrap(); assert_eq!(data, read_data); } @@ -353,9 +351,9 @@ mod tests { }, }; let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); + data.azalea_write(&mut buf).unwrap(); let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = BrigadierNodeStub::read_from(&mut data_cursor).unwrap(); + let read_data = BrigadierNodeStub::azalea_read(&mut data_cursor).unwrap(); assert_eq!(data, read_data); } @@ -372,9 +370,9 @@ mod tests { }, }; let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); + data.azalea_write(&mut buf).unwrap(); let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = BrigadierNodeStub::read_from(&mut data_cursor).unwrap(); + let read_data = BrigadierNodeStub::azalea_read(&mut data_cursor).unwrap(); assert_eq!(data, read_data); } } diff --git a/azalea-protocol/src/packets/game/c_container_close.rs b/azalea-protocol/src/packets/game/c_container_close.rs new file mode 100644 index 00000000..dda6153b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_close.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerClose { + pub container_id: u8, +} diff --git a/azalea-protocol/src/packets/game/c_container_set_content.rs b/azalea-protocol/src/packets/game/c_container_set_content.rs new file mode 100755 index 00000000..852ce60f --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_set_content.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerSetContent { + pub container_id: i8, + #[var] + pub state_id: u32, + pub items: Vec<ItemStack>, + pub carried_item: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/c_container_set_data.rs b/azalea-protocol/src/packets/game/c_container_set_data.rs new file mode 100755 index 00000000..3815f5c5 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_set_data.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerSetData { + pub container_id: i8, + pub id: u16, + pub value: u16, +} diff --git a/azalea-protocol/src/packets/game/c_container_set_slot.rs b/azalea-protocol/src/packets/game/c_container_set_slot.rs new file mode 100755 index 00000000..5e3476d9 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_set_slot.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerSetSlot { + pub container_id: i8, + #[var] + pub state_id: u32, + pub slot: u16, + pub item_stack: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs b/azalea-protocol/src/packets/game/c_cookie_request.rs index 9f1c1d43..330b7334 100755 --- a/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs +++ b/azalea-protocol/src/packets/game/c_cookie_request.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCookieRequestPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCookieRequest { pub key: ResourceLocation, } diff --git a/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs b/azalea-protocol/src/packets/game/c_cooldown.rs index 41c8291a..016101b7 100755 --- a/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs +++ b/azalea-protocol/src/packets/game/c_cooldown.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCooldownPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCooldown { pub item: azalea_registry::Item, #[var] pub duration: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_custom_chat_completions_packet.rs b/azalea-protocol/src/packets/game/c_custom_chat_completions.rs index 3165bbbe..87c27b7a 100755 --- a/azalea-protocol/src/packets/game/clientbound_custom_chat_completions_packet.rs +++ b/azalea-protocol/src/packets/game/c_custom_chat_completions.rs @@ -1,13 +1,13 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomChatCompletionsPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomChatCompletions { pub action: Action, pub entries: Vec<String>, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Action { Add = 0, Remove = 1, diff --git a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/c_custom_payload.rs index fb5f11ba..0610d63e 100755 --- a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs +++ b/azalea-protocol/src/packets/game/c_custom_payload.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_buf::UnsizedByteArray; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomPayloadPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomPayload { pub identifier: ResourceLocation, pub data: UnsizedByteArray, } diff --git a/azalea-protocol/src/packets/game/clientbound_custom_report_details_packet.rs b/azalea-protocol/src/packets/game/c_custom_report_details.rs index a098f915..85eccfb7 100644 --- a/azalea-protocol/src/packets/game/clientbound_custom_report_details_packet.rs +++ b/azalea-protocol/src/packets/game/c_custom_report_details.rs @@ -1,10 +1,10 @@ use std::collections::HashMap; -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomReportDetailsPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomReportDetails { // azalea doesn't implement max lengths yet // max length = 32 diff --git a/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs b/azalea-protocol/src/packets/game/c_custom_sound.rs index 05b1560b..7daadb3a 100644 --- a/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs +++ b/azalea-protocol/src/packets/game/c_custom_sound.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomSoundPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomSound { pub name: ResourceLocation, pub source: SoundSource, pub x: i32, @@ -13,7 +13,7 @@ pub struct ClientboundCustomSoundPacket { pub pitch: f32, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum SoundSource { Master = 0, Music = 1, diff --git a/azalea-protocol/src/packets/game/c_damage_event.rs b/azalea-protocol/src/packets/game/c_damage_event.rs new file mode 100644 index 00000000..a736f39a --- /dev/null +++ b/azalea-protocol/src/packets/game/c_damage_event.rs @@ -0,0 +1,35 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite}; +use azalea_core::position::Vec3; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDamageEvent { + #[var] + pub entity_id: u32, + #[var] + pub source_type_id: u32, + pub source_cause_id: OptionalEntityId, + pub source_direct_id: OptionalEntityId, + pub source_position: Option<Vec3>, +} + +#[derive(Clone, Debug)] +pub struct OptionalEntityId(pub Option<u32>); +impl AzaleaRead for OptionalEntityId { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { + match u32::azalea_read_var(buf)? { + 0 => Ok(OptionalEntityId(None)), + id => Ok(OptionalEntityId(Some(id - 1))), + } + } +} +impl AzaleaWrite for OptionalEntityId { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self.0 { + Some(id) => (id + 1).azalea_write_var(buf), + None => 0u32.azalea_write_var(buf), + } + } +} diff --git a/azalea-protocol/src/packets/game/c_debug_sample.rs b/azalea-protocol/src/packets/game/c_debug_sample.rs new file mode 100755 index 00000000..50550062 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_debug_sample.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::s_debug_sample_subscription::RemoteDebugSampleType; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDebugSample { + pub sample: Vec<u64>, + pub debug_sample_type: RemoteDebugSampleType, +} diff --git a/azalea-protocol/src/packets/game/c_delete_chat.rs b/azalea-protocol/src/packets/game/c_delete_chat.rs new file mode 100755 index 00000000..d44a4553 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_delete_chat.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::c_player_chat::PackedMessageSignature; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDeleteChat { + pub signature: PackedMessageSignature, +} diff --git a/azalea-protocol/src/packets/game/c_disconnect.rs b/azalea-protocol/src/packets/game/c_disconnect.rs new file mode 100755 index 00000000..ba197f1d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_disconnect.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDisconnect { + pub reason: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs b/azalea-protocol/src/packets/game/c_disguised_chat.rs index 24e1a992..90dc5d64 100644 --- a/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs +++ b/azalea-protocol/src/packets/game/c_disguised_chat.rs @@ -1,23 +1,23 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::{ translatable_component::{StringOrComponent, TranslatableComponent}, FormattedText, }; use azalea_protocol_macros::ClientboundGamePacket; -use super::clientbound_player_chat_packet::ChatTypeBound; +use super::c_player_chat::ChatTypeBound; // A disguised chat packet is basically the same as a normal -// [`ClientboundPlayerChatPacket`], except that it doesn't have any of the chat +// [`ClientboundPlayerChat`], except that it doesn't have any of the chat // signing things. Vanilla servers use this when messages are sent from the // console. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)] -pub struct ClientboundDisguisedChatPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)] +pub struct ClientboundDisguisedChat { pub message: FormattedText, pub chat_type: ChatTypeBound, } -impl ClientboundDisguisedChatPacket { +impl ClientboundDisguisedChat { /// Get the full message, including the sender part. #[must_use] pub fn message(&self) -> FormattedText { diff --git a/azalea-protocol/src/packets/game/c_entity_event.rs b/azalea-protocol/src/packets/game/c_entity_event.rs new file mode 100755 index 00000000..13efbabd --- /dev/null +++ b/azalea-protocol/src/packets/game/c_entity_event.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundEntityEvent { + pub entity_id: u32, + pub event_id: u8, +} diff --git a/azalea-protocol/src/packets/game/clientbound_entity_position_sync_packet.rs b/azalea-protocol/src/packets/game/c_entity_position_sync.rs index 0125eeb4..c5cde322 100755 --- a/azalea-protocol/src/packets/game/clientbound_entity_position_sync_packet.rs +++ b/azalea-protocol/src/packets/game/c_entity_position_sync.rs @@ -1,16 +1,16 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::Vec3; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundEntityPositionSyncPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundEntityPositionSync { #[var] pub id: u32, pub values: PositionMoveRotation, pub on_ground: bool, } -#[derive(McBuf, Clone, Debug)] +#[derive(AzBuf, Clone, Debug)] pub struct PositionMoveRotation { pub position: Vec3, pub delta_movement: Vec3, diff --git a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs b/azalea-protocol/src/packets/game/c_explode.rs index 23c416d1..aef3887d 100755 --- a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs +++ b/azalea-protocol/src/packets/game/c_explode.rs @@ -3,15 +3,13 @@ use std::{ str::FromStr, }; -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_core::{position::BlockPos, resource_location::ResourceLocation}; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::{ParticleKind, SoundEvent}; #[derive(Clone, Debug, PartialEq, ClientboundGamePacket)] -pub struct ClientboundExplodePacket { +pub struct ClientboundExplode { pub x: f64, pub y: f64, pub z: f64, @@ -26,7 +24,7 @@ pub struct ClientboundExplodePacket { pub explosion_sound: SoundEvent, } -#[derive(Clone, Copy, Debug, PartialEq, McBuf)] +#[derive(Clone, Copy, Debug, PartialEq, AzBuf)] pub enum BlockInteraction { Keep, Destroy, @@ -34,36 +32,36 @@ pub enum BlockInteraction { TriggerBlock, } -impl McBufReadable for ClientboundExplodePacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let x = f64::read_from(buf)?; - let y = f64::read_from(buf)?; - let z = f64::read_from(buf)?; - let power = f32::read_from(buf)?; +impl AzaleaRead for ClientboundExplode { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let x = f64::azalea_read(buf)?; + let y = f64::azalea_read(buf)?; + let z = f64::azalea_read(buf)?; + let power = f32::azalea_read(buf)?; let x_floor = x.floor() as i32; let y_floor = y.floor() as i32; let z_floor = z.floor() as i32; - let to_blow_len = u32::var_read_from(buf)?; + let to_blow_len = u32::azalea_read_var(buf)?; let mut to_blow = Vec::with_capacity(to_blow_len as usize); for _ in 0..to_blow_len { // the bytes are offsets from the main x y z - let x = x_floor + i32::from(i8::read_from(buf)?); - let y = y_floor + i32::from(i8::read_from(buf)?); - let z = z_floor + i32::from(i8::read_from(buf)?); + let x = x_floor + i32::from(i8::azalea_read(buf)?); + let y = y_floor + i32::from(i8::azalea_read(buf)?); + let z = z_floor + i32::from(i8::azalea_read(buf)?); to_blow.push(BlockPos { x, y, z }); } - let knockback_x = f32::read_from(buf)?; - let knockback_y = f32::read_from(buf)?; - let knockback_z = f32::read_from(buf)?; + let knockback_x = f32::azalea_read(buf)?; + let knockback_y = f32::azalea_read(buf)?; + let knockback_z = f32::azalea_read(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 block_interaction = BlockInteraction::azalea_read(buf)?; + let small_explosion_particles = ParticleKind::azalea_read(buf)?; + let large_explosion_particles = ParticleKind::azalea_read(buf)?; - let sound_event_resource_location = ResourceLocation::read_from(buf)?.to_string(); + let sound_event_resource_location = ResourceLocation::azalea_read(buf)?.to_string(); let explosion_sound = SoundEvent::from_str(&sound_event_resource_location).map_err(|_| { BufReadError::UnexpectedStringEnumVariant { @@ -88,15 +86,15 @@ impl McBufReadable for ClientboundExplodePacket { } } -impl McBufWritable for ClientboundExplodePacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.x.write_into(buf)?; - self.y.write_into(buf)?; - self.z.write_into(buf)?; - self.power.write_into(buf)?; +impl AzaleaWrite for ClientboundExplode { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.x.azalea_write(buf)?; + self.y.azalea_write(buf)?; + self.z.azalea_write(buf)?; + self.power.azalea_write(buf)?; let to_blow_len = self.to_blow.len() as u32; - to_blow_len.var_write_into(buf)?; + to_blow_len.azalea_write_var(buf)?; let x_floor = self.x.floor() as i32; let y_floor = self.y.floor() as i32; @@ -106,22 +104,22 @@ impl McBufWritable for ClientboundExplodePacket { let x = (pos.x - x_floor) as i8; let y = (pos.y - y_floor) as i8; let z = (pos.z - z_floor) as i8; - x.write_into(buf)?; - y.write_into(buf)?; - z.write_into(buf)?; + x.azalea_write(buf)?; + y.azalea_write(buf)?; + z.azalea_write(buf)?; } - self.knockback_x.write_into(buf)?; - self.knockback_y.write_into(buf)?; - self.knockback_z.write_into(buf)?; + self.knockback_x.azalea_write(buf)?; + self.knockback_y.azalea_write(buf)?; + self.knockback_z.azalea_write(buf)?; - self.block_interaction.write_into(buf)?; - self.small_explosion_particles.write_into(buf)?; - self.large_explosion_particles.write_into(buf)?; + self.block_interaction.azalea_write(buf)?; + self.small_explosion_particles.azalea_write(buf)?; + self.large_explosion_particles.azalea_write(buf)?; let sound_event_resource_location = ResourceLocation::new(&self.explosion_sound.to_string()); - sound_event_resource_location.write_into(buf)?; + sound_event_resource_location.azalea_write(buf)?; Ok(()) } @@ -133,7 +131,7 @@ mod tests { #[test] fn test_read_write() { - let packet = ClientboundExplodePacket { + let packet = ClientboundExplode { x: 123_456.0, y: 789_012.0, z: 345_678.0, @@ -159,8 +157,8 @@ mod tests { explosion_sound: SoundEvent::EntityGenericExplode, }; let mut buf = Vec::new(); - packet.write_into(&mut buf).unwrap(); - let packet2 = ClientboundExplodePacket::read_from(&mut Cursor::new(&buf)).unwrap(); + packet.azalea_write(&mut buf).unwrap(); + let packet2 = ClientboundExplode::azalea_read(&mut Cursor::new(&buf)).unwrap(); assert_eq!(packet, packet2); } } diff --git a/azalea-protocol/src/packets/game/c_forget_level_chunk.rs b/azalea-protocol/src/packets/game/c_forget_level_chunk.rs new file mode 100755 index 00000000..bd901634 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_forget_level_chunk.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::position::ChunkPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundForgetLevelChunk { + pub pos: ChunkPos, +} diff --git a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs b/azalea-protocol/src/packets/game/c_game_event.rs index 2416f7c3..940aa2f1 100755 --- a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs +++ b/azalea-protocol/src/packets/game/c_game_event.rs @@ -1,13 +1,13 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundGameEventPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundGameEvent { pub event: EventType, pub param: f32, } -#[derive(Clone, Debug, Copy, McBuf)] +#[derive(Clone, Debug, Copy, AzBuf)] pub enum EventType { NoRespawnBlockAvailable = 0, StartRaining = 1, diff --git a/azalea-protocol/src/packets/game/clientbound_horse_screen_open_packet.rs b/azalea-protocol/src/packets/game/c_horse_screen_open.rs index ad3f7b37..13a67253 100755 --- a/azalea-protocol/src/packets/game/clientbound_horse_screen_open_packet.rs +++ b/azalea-protocol/src/packets/game/c_horse_screen_open.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundHorseScreenOpenPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundHorseScreenOpen { pub container_id: u8, #[var] pub size: u32, diff --git a/azalea-protocol/src/packets/game/c_hurt_animation.rs b/azalea-protocol/src/packets/game/c_hurt_animation.rs new file mode 100644 index 00000000..49a32989 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_hurt_animation.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundHurtAnimation { + #[var] + pub id: u32, + pub yaw: f32, +} diff --git a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs b/azalea-protocol/src/packets/game/c_initialize_border.rs index 77742c0a..ca338b7f 100755 --- a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs +++ b/azalea-protocol/src/packets/game/c_initialize_border.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, ClientboundGamePacket, McBuf)] -pub struct ClientboundInitializeBorderPacket { +#[derive(Clone, Debug, ClientboundGamePacket, AzBuf)] +pub struct ClientboundInitializeBorder { pub new_center_x: f64, pub new_center_z: f64, pub old_size: f64, diff --git a/azalea-protocol/src/packets/game/c_keep_alive.rs b/azalea-protocol/src/packets/game/c_keep_alive.rs new file mode 100755 index 00000000..ff93560b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_keep_alive.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundKeepAlive { + pub id: u64, +} diff --git a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs b/azalea-protocol/src/packets/game/c_level_chunk_with_light.rs index f7212ba7..a4a6da45 100755 --- a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs +++ b/azalea-protocol/src/packets/game/c_level_chunk_with_light.rs @@ -1,18 +1,18 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; use simdnbt::owned::Nbt; -use super::clientbound_light_update_packet::ClientboundLightUpdatePacketData; +use super::c_light_update::ClientboundLightUpdatePacketData; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLevelChunkWithLightPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLevelChunkWithLight { pub x: i32, pub z: i32, pub chunk_data: ClientboundLevelChunkPacketData, pub light_data: ClientboundLightUpdatePacketData, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct ClientboundLevelChunkPacketData { pub heightmaps: Nbt, // we can't parse the data in azalea-protocol because it depends on context from other packets @@ -20,7 +20,7 @@ pub struct ClientboundLevelChunkPacketData { pub block_entities: Vec<BlockEntity>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct BlockEntity { pub packed_xz: u8, pub y: u16, @@ -32,21 +32,20 @@ pub struct BlockEntity { mod tests { use std::{io::Cursor, ops::Deref}; - use azalea_buf::McBufReadable; + use azalea_buf::AzaleaRead; use azalea_world::Chunk; use simdnbt::owned::BaseNbt; use super::*; #[test] - fn test_clientbound_level_chunk_with_light_packet() { + fn test_c_level_chunk_with_light_packet() { #[rustfmt::skip] let bytes = [ 255, 255, 255, 253, 0, 0, 0, 1, 10, 12, 0, 15, 77, 79, 84, 73, 79, 78, 95, 66, 76, 79, 67, 75, 73, 78, 71, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 240, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 195, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 136, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 33, 16, 0, 0, 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0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 33, 67, 101, 135, 169, 203, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 33, 67, 101, 135, 169, 203, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; - let packet = - ClientboundLevelChunkWithLightPacket::read_from(&mut Cursor::new(&bytes)).unwrap(); + let packet = ClientboundLevelChunkWithLight::azalea_read(&mut Cursor::new(&bytes)).unwrap(); let heightmaps_nbt = &packet.chunk_data.heightmaps; // necessary to make the unwrap_or work diff --git a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs b/azalea-protocol/src/packets/game/c_level_event.rs index a79217f1..f41a1f42 100755 --- a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs +++ b/azalea-protocol/src/packets/game/c_level_event.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLevelEventPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLevelEvent { pub event_type: u32, pub pos: BlockPos, pub data: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs b/azalea-protocol/src/packets/game/c_level_particles.rs index eae99634..d700673c 100755 --- a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs +++ b/azalea-protocol/src/packets/game/c_level_particles.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_entity::particle::Particle; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLevelParticlesPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLevelParticles { pub override_limiter: bool, pub x: f64, pub y: f64, @@ -20,12 +20,12 @@ pub struct ClientboundLevelParticlesPacket { mod tests { use std::io::Cursor; - use azalea_buf::McBufReadable; + use azalea_buf::AzaleaRead; use super::*; #[test] - fn test_clientbound_level_particles_packet() { + fn test_c_level_particles_packet() { let slice = &[ 0, 64, 139, 10, 0, 0, 0, 0, 0, 192, 26, 0, 0, 0, 0, 0, 0, 64, 144, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 63, 128, 0, 0, 0, 0, 0, @@ -33,7 +33,7 @@ mod tests { ][..]; let mut bytes = Cursor::new(slice); - let _packet = ClientboundLevelParticlesPacket::read_from(&mut bytes).unwrap(); + let _packet = ClientboundLevelParticles::azalea_read(&mut bytes).unwrap(); assert_eq!(bytes.position(), slice.len() as u64); } } diff --git a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs b/azalea-protocol/src/packets/game/c_light_update.rs index 8d50e94d..72523291 100755 --- a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs +++ b/azalea-protocol/src/packets/game/c_light_update.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::bitset::BitSet; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLightUpdatePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLightUpdate { #[var] pub x: i32, #[var] @@ -11,7 +11,7 @@ pub struct ClientboundLightUpdatePacket { pub light_data: ClientboundLightUpdatePacketData, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct ClientboundLightUpdatePacketData { pub sky_y_mask: BitSet, pub block_y_mask: BitSet, diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/c_login.rs index 234439d5..c0616c55 100755 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ b/azalea-protocol/src/packets/game/c_login.rs @@ -1,4 +1,4 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; @@ -8,8 +8,8 @@ use crate::packets::common::CommonPlayerSpawnInfo; /// /// This packet contains information about the state of the player, the /// world, and the registry. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLoginPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLogin { pub player_id: u32, pub hardcore: bool, pub levels: Vec<ResourceLocation>, diff --git a/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs b/azalea-protocol/src/packets/game/c_map_item_data.rs index 0f858181..9a41ed85 100755 --- a/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs +++ b/azalea-protocol/src/packets/game/c_map_item_data.rs @@ -1,9 +1,9 @@ -use azalea_buf::{McBuf, McBufReadable, McBufWritable}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, ClientboundGamePacket, McBuf)] -pub struct ClientboundMapItemDataPacket { +#[derive(Clone, Debug, ClientboundGamePacket, AzBuf)] +pub struct ClientboundMapItemData { #[var] pub map_id: u32, pub scale: u8, @@ -12,7 +12,7 @@ pub struct ClientboundMapItemDataPacket { pub color_patch: OptionalMapPatch, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct MapDecoration { pub decoration_type: DecorationType, pub x: i8, @@ -26,28 +26,28 @@ pub struct MapDecoration { #[derive(Debug, Clone)] pub struct OptionalMapPatch(pub Option<MapPatch>); -impl McBufReadable for OptionalMapPatch { - fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { +impl AzaleaRead for OptionalMapPatch { + fn azalea_read(buf: &mut std::io::Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { let pos = buf.position(); - Ok(Self(if u8::read_from(buf)? == 0 { + Ok(Self(if u8::azalea_read(buf)? == 0 { None } else { buf.set_position(pos); - Some(MapPatch::read_from(buf)?) + Some(MapPatch::azalea_read(buf)?) })) } } -impl McBufWritable for OptionalMapPatch { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for OptionalMapPatch { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { match &self.0 { - None => 0u8.write_into(buf), - Some(m) => m.write_into(buf), + None => 0u8.azalea_write(buf), + Some(m) => m.azalea_write(buf), } } } -#[derive(Debug, Clone, McBuf)] +#[derive(Debug, Clone, AzBuf)] pub struct MapPatch { pub width: u8, pub height: u8, @@ -56,7 +56,7 @@ pub struct MapPatch { pub map_colors: Vec<u8>, } -#[derive(Clone, Copy, Debug, McBuf)] +#[derive(Clone, Copy, Debug, AzBuf)] pub enum DecorationType { Player, Frame, diff --git a/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs b/azalea-protocol/src/packets/game/c_merchant_offers.rs index 4253ace4..e1822579 100755 --- a/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs +++ b/azalea-protocol/src/packets/game/c_merchant_offers.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMerchantOffersPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMerchantOffers { #[var] pub container_id: u32, pub offers: Vec<MerchantOffer>, @@ -15,11 +15,11 @@ pub struct ClientboundMerchantOffersPacket { pub can_restock: bool, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct MerchantOffer { - pub base_cost_a: ItemSlot, - pub result: ItemSlot, - pub cost_b: ItemSlot, + pub base_cost_a: ItemStack, + pub result: ItemStack, + pub cost_b: ItemStack, pub out_of_stock: bool, pub uses: u32, pub max_uses: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs b/azalea-protocol/src/packets/game/c_move_entity_pos.rs index d909fdcc..b153bb3c 100755 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs +++ b/azalea-protocol/src/packets/game/c_move_entity_pos.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::delta::PositionDelta8; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveEntityPosPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveEntityPos { #[var] pub entity_id: u32, pub delta: PositionDelta8, diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_rot_packet.rs b/azalea-protocol/src/packets/game/c_move_entity_pos_rot.rs index 5a5dfbd3..7b22e290 100755 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_rot_packet.rs +++ b/azalea-protocol/src/packets/game/c_move_entity_pos_rot.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::delta::PositionDelta8; use azalea_protocol_macros::ClientboundGamePacket; /// This packet is sent by the server when an entity moves less then 8 blocks. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveEntityPosRotPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveEntityPosRot { #[var] pub entity_id: u32, pub delta: PositionDelta8, diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs b/azalea-protocol/src/packets/game/c_move_entity_rot.rs index 666abe23..a8362748 100755 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs +++ b/azalea-protocol/src/packets/game/c_move_entity_rot.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveEntityRotPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveEntityRot { #[var] pub entity_id: u32, pub y_rot: i8, diff --git a/azalea-protocol/src/packets/game/clientbound_move_minecart_packet.rs b/azalea-protocol/src/packets/game/c_move_minecart_along_track.rs index 014e2aaa..0a205ddd 100644 --- a/azalea-protocol/src/packets/game/clientbound_move_minecart_packet.rs +++ b/azalea-protocol/src/packets/game/c_move_minecart_along_track.rs @@ -1,15 +1,15 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::Vec3; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveMinecartPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveMinecartAlongTrack { #[var] pub entity_id: u32, pub lerp_steps: Vec<MinecartStep>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct MinecartStep { pub position: Vec3, pub movement: Vec3, diff --git a/azalea-protocol/src/packets/game/clientbound_move_vehicle_packet.rs b/azalea-protocol/src/packets/game/c_move_vehicle.rs index d2376c35..96e3e5c2 100755 --- a/azalea-protocol/src/packets/game/clientbound_move_vehicle_packet.rs +++ b/azalea-protocol/src/packets/game/c_move_vehicle.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveVehiclePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveVehicle { pub x: f64, pub y: f64, pub z: f64, diff --git a/azalea-protocol/src/packets/game/c_open_book.rs b/azalea-protocol/src/packets/game/c_open_book.rs new file mode 100755 index 00000000..2c4f6b15 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_open_book.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::s_interact::InteractionHand; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundOpenBook { + pub hand: InteractionHand, +} diff --git a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs b/azalea-protocol/src/packets/game/c_open_screen.rs index 582cac17..4ba71725 100755 --- a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs +++ b/azalea-protocol/src/packets/game/c_open_screen.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundOpenScreenPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundOpenScreen { #[var] pub container_id: u32, pub menu_type: azalea_registry::MenuKind, diff --git a/azalea-protocol/src/packets/game/clientbound_open_sign_editor_packet.rs b/azalea-protocol/src/packets/game/c_open_sign_editor.rs index 0b03cbe2..52f5922c 100755 --- a/azalea-protocol/src/packets/game/clientbound_open_sign_editor_packet.rs +++ b/azalea-protocol/src/packets/game/c_open_sign_editor.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundOpenSignEditorPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundOpenSignEditor { pub pos: BlockPos, pub is_front_text: bool, } diff --git a/azalea-protocol/src/packets/game/c_ping.rs b/azalea-protocol/src/packets/game/c_ping.rs new file mode 100755 index 00000000..956aca8d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_ping.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPing { + pub id: u32, +} diff --git a/azalea-protocol/src/packets/game/clientbound_place_ghost_recipe_packet.rs b/azalea-protocol/src/packets/game/c_place_ghost_recipe.rs index 4d61a526..41c32403 100755 --- a/azalea-protocol/src/packets/game/clientbound_place_ghost_recipe_packet.rs +++ b/azalea-protocol/src/packets/game/c_place_ghost_recipe.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlaceGhostRecipePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlaceGhostRecipe { pub container_id: u8, pub recipe: ResourceLocation, } diff --git a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/c_player_abilities.rs index 48c8b41a..c32a99fe 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs +++ b/azalea-protocol/src/packets/game/c_player_abilities.rs @@ -1,12 +1,12 @@ use std::io::{Cursor, Write}; -use azalea_buf::{BufReadError, McBuf}; -use azalea_buf::{McBufReadable, McBufWritable}; +use azalea_buf::{AzBuf, BufReadError}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; use azalea_core::bitset::FixedBitSet; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerAbilitiesPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerAbilities { pub flags: PlayerAbilitiesFlags, pub flying_speed: f32, /// Used for the fov @@ -21,9 +21,9 @@ pub struct PlayerAbilitiesFlags { pub instant_break: bool, } -impl McBufReadable for PlayerAbilitiesFlags { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let set = FixedBitSet::<4>::read_from(buf)?; +impl AzaleaRead for PlayerAbilitiesFlags { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let set = FixedBitSet::<4>::azalea_read(buf)?; Ok(PlayerAbilitiesFlags { invulnerable: set.index(0), flying: set.index(1), @@ -33,8 +33,8 @@ impl McBufReadable for PlayerAbilitiesFlags { } } -impl McBufWritable for PlayerAbilitiesFlags { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for PlayerAbilitiesFlags { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<4>::new(); if self.invulnerable { set.set(0); @@ -48,6 +48,6 @@ impl McBufWritable for PlayerAbilitiesFlags { if self.instant_break { set.set(3); } - set.write_into(buf) + set.azalea_write(buf) } } diff --git a/azalea-protocol/src/packets/game/c_player_chat.rs b/azalea-protocol/src/packets/game/c_player_chat.rs new file mode 100644 index 00000000..0e9960f2 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_chat.rs @@ -0,0 +1,160 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_chat::{ + translatable_component::{StringOrComponent, TranslatableComponent}, + FormattedText, +}; +use azalea_core::bitset::BitSet; +use azalea_crypto::MessageSignature; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::{ChatType, OptionalRegistry}; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)] +pub struct ClientboundPlayerChat { + pub sender: Uuid, + #[var] + pub index: u32, + pub signature: Option<MessageSignature>, + pub body: PackedSignedMessageBody, + pub unsigned_content: Option<FormattedText>, + pub filter_mask: FilterMask, + pub chat_type: ChatTypeBound, +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct PackedSignedMessageBody { + // the error is here, for some reason it skipped a byte earlier and here + // it's reading `0` when it should be `11` + pub content: String, + pub timestamp: u64, + pub salt: u64, + pub last_seen: PackedLastSeenMessages, +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct PackedLastSeenMessages { + pub entries: Vec<PackedMessageSignature>, +} + +/// Messages can be deleted by either their signature or message id. +#[derive(Clone, Debug, PartialEq)] +pub enum PackedMessageSignature { + Signature(Box<MessageSignature>), + Id(u32), +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub enum FilterMask { + PassThrough, + FullyFiltered, + PartiallyFiltered(BitSet), +} + +#[derive(Clone, Debug, PartialEq)] +pub struct ChatTypeBound { + pub chat_type: ChatType, + pub name: FormattedText, + pub target_name: Option<FormattedText>, +} +impl AzaleaRead for ChatTypeBound { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let Some(chat_type) = OptionalRegistry::<ChatType>::azalea_read(buf)?.0 else { + return Err(BufReadError::Custom("ChatType cannot be None".to_owned())); + }; + let name = FormattedText::azalea_read(buf)?; + let target_name = Option::<FormattedText>::azalea_read(buf)?; + + Ok(ChatTypeBound { + chat_type, + name, + target_name, + }) + } +} +impl AzaleaWrite for ChatTypeBound { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + OptionalRegistry(Some(self.chat_type)).azalea_write(buf)?; + self.name.azalea_write(buf)?; + self.target_name.azalea_write(buf)?; + Ok(()) + } +} + +// must be in Client +#[derive(Clone, Debug, PartialEq)] +pub struct MessageSignatureCache { + pub entries: Vec<Option<MessageSignature>>, +} + +// impl MessageSignatureCache { +// pub fn unpacker(&self) -> impl Fn(u32) -> Option<SignedMessageBody> { + +// } +// } + +// impl PackedSignedMessageBody { +// pub fn unpack(&self, unpacker: impl Fn(u32) -> Option<SignedMessageBody>) +// {} } + +impl ClientboundPlayerChat { + /// Returns the content of the message. If you want to get the FormattedText + /// for the whole message including the sender part, use + /// [`ClientboundPlayerChat::message`]. + #[must_use] + pub fn content(&self) -> FormattedText { + self.unsigned_content + .clone() + .unwrap_or_else(|| FormattedText::from(self.body.content.clone())) + } + + /// Get the full message, including the sender part. + #[must_use] + pub fn message(&self) -> FormattedText { + let sender = self.chat_type.name.clone(); + let content = self.content(); + let target = self.chat_type.target_name.clone(); + + let translation_key = self.chat_type.chat_type.chat_translation_key(); + + let mut args = vec![ + StringOrComponent::FormattedText(sender), + StringOrComponent::FormattedText(content), + ]; + if let Some(target) = target { + args.push(StringOrComponent::FormattedText(target)); + } + + let component = TranslatableComponent::new(translation_key.to_string(), args); + + FormattedText::Translatable(component) + } +} + +impl AzaleaRead for PackedMessageSignature { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let id = u32::azalea_read_var(buf)?; + if id == 0 { + let full_signature = MessageSignature::azalea_read(buf)?; + + Ok(PackedMessageSignature::Signature(Box::new(full_signature))) + } else { + Ok(PackedMessageSignature::Id(id - 1)) + } + } +} +impl AzaleaWrite for PackedMessageSignature { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + PackedMessageSignature::Signature(full_signature) => { + 0u32.azalea_write_var(buf)?; + full_signature.azalea_write(buf)?; + } + PackedMessageSignature::Id(id) => { + (id + 1).azalea_write_var(buf)?; + } + } + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_header_packet.rs b/azalea-protocol/src/packets/game/c_player_chat_header.rs index 0e86a36d..d7e84cc5 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_header_packet.rs +++ b/azalea-protocol/src/packets/game/c_player_chat_header.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_crypto::{MessageSignature, SignedMessageHeader}; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerChatHeaderPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerChatHeader { pub header: SignedMessageHeader, pub header_signature: MessageSignature, pub body_digest: Vec<u8>, diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs b/azalea-protocol/src/packets/game/c_player_combat_end.rs index dafb839f..b8029f1b 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs +++ b/azalea-protocol/src/packets/game/c_player_combat_end.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; /// Unused by the client in vanilla. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerCombatEndPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerCombatEnd { #[var] pub duration: u32, } diff --git a/azalea-protocol/src/packets/game/c_player_combat_enter.rs b/azalea-protocol/src/packets/game/c_player_combat_enter.rs new file mode 100755 index 00000000..8c344b49 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_combat_enter.rs @@ -0,0 +1,6 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +/// Unused in vanilla. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerCombatEnter {} diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs b/azalea-protocol/src/packets/game/c_player_combat_kill.rs index c309342f..fb7285b5 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs +++ b/azalea-protocol/src/packets/game/c_player_combat_kill.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; /// Used to send a respawn screen. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerCombatKillPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerCombatKill { #[var] pub player_id: u32, pub message: FormattedText, diff --git a/azalea-protocol/src/packets/game/c_player_info_remove.rs b/azalea-protocol/src/packets/game/c_player_info_remove.rs new file mode 100644 index 00000000..fcaef9d4 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_info_remove.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerInfoRemove { + pub profile_ids: Vec<Uuid>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs b/azalea-protocol/src/packets/game/c_player_info_update.rs index 2b286e64..73c463d5 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs +++ b/azalea-protocol/src/packets/game/c_player_info_update.rs @@ -4,18 +4,16 @@ use std::{ }; use azalea_auth::game_profile::{GameProfile, ProfilePropertyValue}; -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_chat::FormattedText; use azalea_core::{bitset::FixedBitSet, game_type::GameMode}; use azalea_protocol_macros::ClientboundGamePacket; use uuid::Uuid; -use super::serverbound_chat_session_update_packet::RemoteChatSessionData; +use super::s_chat_session_update::RemoteChatSessionData; #[derive(Clone, Debug, ClientboundGamePacket)] -pub struct ClientboundPlayerInfoUpdatePacket { +pub struct ClientboundPlayerInfoUpdate { pub actions: ActionEnumSet, pub entries: Vec<PlayerInfoEntry>, } @@ -28,133 +26,142 @@ pub struct PlayerInfoEntry { pub game_mode: GameMode, pub display_name: Option<FormattedText>, pub list_order: i32, + pub update_hat: bool, pub chat_session: Option<RemoteChatSessionData>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct AddPlayerAction { pub name: String, pub properties: HashMap<String, ProfilePropertyValue>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct InitializeChatAction { pub chat_session: Option<RemoteChatSessionData>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct UpdateGameModeAction { pub game_mode: GameMode, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct UpdateListedAction { pub listed: bool, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct UpdateLatencyAction { #[var] pub latency: i32, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct UpdateDisplayNameAction { pub display_name: Option<FormattedText>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] +pub struct UpdateHatAction { + pub update_hat: bool, +} +#[derive(Clone, Debug, AzBuf)] pub struct UpdateListOrderAction { #[var] pub list_order: i32, } -impl McBufReadable for ClientboundPlayerInfoUpdatePacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let actions = ActionEnumSet::read_from(buf)?; +impl AzaleaRead for ClientboundPlayerInfoUpdate { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let actions = ActionEnumSet::azalea_read(buf)?; let mut entries = Vec::new(); - let entry_count = u32::var_read_from(buf)?; + let entry_count = u32::azalea_read_var(buf)?; for _ in 0..entry_count { - let profile_id = Uuid::read_from(buf)?; + let profile_id = Uuid::azalea_read(buf)?; let mut entry = PlayerInfoEntry::default(); entry.profile.uuid = profile_id; if actions.add_player { - let action = AddPlayerAction::read_from(buf)?; + let action = AddPlayerAction::azalea_read(buf)?; entry.profile.name = action.name; entry.profile.properties = action.properties; } if actions.initialize_chat { - let action = InitializeChatAction::read_from(buf)?; + let action = InitializeChatAction::azalea_read(buf)?; entry.chat_session = action.chat_session; } if actions.update_game_mode { - let action = UpdateGameModeAction::read_from(buf)?; + let action = UpdateGameModeAction::azalea_read(buf)?; entry.game_mode = action.game_mode; } if actions.update_listed { - let action = UpdateListedAction::read_from(buf)?; + let action = UpdateListedAction::azalea_read(buf)?; entry.listed = action.listed; } if actions.update_latency { - let action = UpdateLatencyAction::read_from(buf)?; + let action = UpdateLatencyAction::azalea_read(buf)?; entry.latency = action.latency; } if actions.update_display_name { - let action = UpdateDisplayNameAction::read_from(buf)?; + let action = UpdateDisplayNameAction::azalea_read(buf)?; entry.display_name = action.display_name; } + if actions.update_hat { + let action = UpdateHatAction::azalea_read(buf)?; + entry.update_hat = action.update_hat; + } if actions.update_list_order { - let action = UpdateListOrderAction::read_from(buf)?; + let action = UpdateListOrderAction::azalea_read(buf)?; entry.list_order = action.list_order; } entries.push(entry); } - Ok(ClientboundPlayerInfoUpdatePacket { actions, entries }) + Ok(ClientboundPlayerInfoUpdate { actions, entries }) } } -impl McBufWritable for ClientboundPlayerInfoUpdatePacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.actions.write_into(buf)?; +impl AzaleaWrite for ClientboundPlayerInfoUpdate { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.actions.azalea_write(buf)?; - (self.entries.len() as u32).var_write_into(buf)?; + (self.entries.len() as u32).azalea_write_var(buf)?; for entry in &self.entries { - entry.profile.uuid.write_into(buf)?; + entry.profile.uuid.azalea_write(buf)?; if self.actions.add_player { AddPlayerAction { name: entry.profile.name.clone(), properties: entry.profile.properties.clone(), } - .write_into(buf)?; + .azalea_write(buf)?; } if self.actions.initialize_chat { InitializeChatAction { chat_session: entry.chat_session.clone(), } - .write_into(buf)?; + .azalea_write(buf)?; } if self.actions.update_game_mode { UpdateGameModeAction { game_mode: entry.game_mode, } - .write_into(buf)?; + .azalea_write(buf)?; } if self.actions.update_listed { UpdateListedAction { listed: entry.listed, } - .write_into(buf)?; + .azalea_write(buf)?; } if self.actions.update_latency { UpdateLatencyAction { latency: entry.latency, } - .write_into(buf)?; + .azalea_write(buf)?; } if self.actions.update_display_name { UpdateDisplayNameAction { display_name: entry.display_name.clone(), } - .write_into(buf)?; + .azalea_write(buf)?; } } @@ -170,12 +177,13 @@ pub struct ActionEnumSet { pub update_listed: bool, pub update_latency: bool, pub update_display_name: bool, + pub update_hat: bool, pub update_list_order: bool, } -impl McBufReadable for ActionEnumSet { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let set = FixedBitSet::<7>::read_from(buf)?; +impl AzaleaRead for ActionEnumSet { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let set = FixedBitSet::<7>::azalea_read(buf)?; Ok(ActionEnumSet { add_player: set.index(0), initialize_chat: set.index(1), @@ -183,13 +191,14 @@ impl McBufReadable for ActionEnumSet { update_listed: set.index(3), update_latency: set.index(4), update_display_name: set.index(5), - update_list_order: set.index(6), + update_hat: set.index(6), + update_list_order: set.index(7), }) } } -impl McBufWritable for ActionEnumSet { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for ActionEnumSet { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<7>::new(); if self.add_player { set.set(0); @@ -209,10 +218,13 @@ impl McBufWritable for ActionEnumSet { if self.update_display_name { set.set(5); } - if self.update_list_order { + if self.update_hat { set.set(6); } - set.write_into(buf)?; + if self.update_list_order { + set.set(7); + } + set.azalea_write(buf)?; Ok(()) } } @@ -230,12 +242,13 @@ mod tests { update_listed: false, update_latency: true, update_display_name: false, + update_hat: false, update_list_order: true, }; let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); + data.azalea_write(&mut buf).unwrap(); let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = ActionEnumSet::read_from(&mut data_cursor).unwrap(); + let read_data = ActionEnumSet::azalea_read(&mut data_cursor).unwrap(); assert_eq!(read_data, data); } @@ -308,6 +321,6 @@ mod tests { 0, ][..], ); - let _packet = ClientboundPlayerInfoUpdatePacket::read_from(&mut bytes).unwrap(); + let _packet = ClientboundPlayerInfoUpdate::azalea_read(&mut bytes).unwrap(); } } diff --git a/azalea-protocol/src/packets/game/clientbound_player_look_at_packet.rs b/azalea-protocol/src/packets/game/c_player_look_at.rs index 47c63d1f..4d886814 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_look_at_packet.rs +++ b/azalea-protocol/src/packets/game/c_player_look_at.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerLookAtPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerLookAt { pub from_anchor: Anchor, pub x: f64, pub y: f64, @@ -10,13 +10,13 @@ pub struct ClientboundPlayerLookAtPacket { pub entity: Option<AtEntity>, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Anchor { Feet = 0, Eyes = 1, } -#[derive(McBuf, Clone, Debug)] +#[derive(AzBuf, Clone, Debug)] pub struct AtEntity { #[var] pub entity: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs b/azalea-protocol/src/packets/game/c_player_position.rs index 2a9cebc6..aa030fc5 100755 --- a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs +++ b/azalea-protocol/src/packets/game/c_player_position.rs @@ -1,11 +1,11 @@ use std::io::{Cursor, Write}; -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; use azalea_core::{bitset::FixedBitSet, position::Vec3}; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerPositionPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerPosition { #[var] pub id: u32, pub pos: Vec3, @@ -24,10 +24,10 @@ pub struct RelativeMovements { pub x_rot: bool, } -impl McBufReadable for RelativeMovements { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { +impl AzaleaRead for RelativeMovements { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { // yes minecraft seriously wastes that many bits, smh - let set = FixedBitSet::<32>::read_from(buf)?; + let set = FixedBitSet::<32>::azalea_read(buf)?; Ok(RelativeMovements { x: set.index(0), y: set.index(1), @@ -38,8 +38,8 @@ impl McBufReadable for RelativeMovements { } } -impl McBufWritable for RelativeMovements { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for RelativeMovements { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<5>::new(); if self.x { set.set(0); @@ -56,6 +56,6 @@ impl McBufWritable for RelativeMovements { if self.x_rot { set.set(4); } - set.write_into(buf) + set.azalea_write(buf) } } diff --git a/azalea-protocol/src/packets/game/c_player_rotation.rs b/azalea-protocol/src/packets/game/c_player_rotation.rs new file mode 100755 index 00000000..33214cf9 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_rotation.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerRotation { + pub y_rot: f32, + pub x_rot: f32, +} diff --git a/azalea-protocol/src/packets/game/c_pong_response.rs b/azalea-protocol/src/packets/game/c_pong_response.rs new file mode 100755 index 00000000..835666db --- /dev/null +++ b/azalea-protocol/src/packets/game/c_pong_response.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPongResponse { + pub time: u64, +} diff --git a/azalea-protocol/src/packets/game/c_projectile_power.rs b/azalea-protocol/src/packets/game/c_projectile_power.rs new file mode 100644 index 00000000..8b453ae2 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_projectile_power.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundProjectilePower { + pub id: u32, + pub acceleration_power: f64, +} diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_book_add_packet.rs b/azalea-protocol/src/packets/game/c_recipe_book_add.rs index e025da7d..e6b91130 100755 --- a/azalea-protocol/src/packets/game/clientbound_recipe_book_add_packet.rs +++ b/azalea-protocol/src/packets/game/c_recipe_book_add.rs @@ -1,21 +1,21 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -use super::clientbound_update_recipes_packet::{Ingredient, SlotDisplayData}; +use super::c_update_recipes::{Ingredient, SlotDisplayData}; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRecipeBookAddPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRecipeBookAdd { pub entries: Vec<Entry>, pub replace: bool, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct Entry { pub contents: RecipeDisplayEntry, pub flags: u8, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct RecipeDisplayEntry { #[var] pub id: u32, @@ -28,7 +28,7 @@ pub struct RecipeDisplayEntry { } /// [`azalea_registry::RecipeDisplay`] -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub enum RecipeDisplayData { Shapeless(ShapelessCraftingRecipeDisplay), Shaped(ShapedCraftingRecipeDisplay), @@ -37,13 +37,13 @@ pub enum RecipeDisplayData { Smithing(SmithingRecipeDisplay), } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct ShapelessCraftingRecipeDisplay { pub ingredients: Vec<SlotDisplayData>, pub result: SlotDisplayData, pub crafting_station: SlotDisplayData, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct ShapedCraftingRecipeDisplay { #[var] pub width: u32, @@ -53,7 +53,7 @@ pub struct ShapedCraftingRecipeDisplay { pub result: SlotDisplayData, pub crafting_station: SlotDisplayData, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct FurnaceRecipeDisplay { pub ingredient: SlotDisplayData, pub fuel: SlotDisplayData, @@ -63,13 +63,13 @@ pub struct FurnaceRecipeDisplay { pub duration: u32, pub experience: f32, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct StonecutterRecipeDisplay { pub input: SlotDisplayData, pub result: SlotDisplayData, pub crafting_station: SlotDisplayData, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct SmithingRecipeDisplay { pub template: SlotDisplayData, pub base: SlotDisplayData, diff --git a/azalea-protocol/src/packets/game/c_recipe_book_remove.rs b/azalea-protocol/src/packets/game/c_recipe_book_remove.rs new file mode 100755 index 00000000..aa5a09fe --- /dev/null +++ b/azalea-protocol/src/packets/game/c_recipe_book_remove.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::{c_entity_position_sync::PositionMoveRotation, c_player_position::RelativeMovements}; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRecipeBookRemove { + #[var] + pub id: u32, + pub change: PositionMoveRotation, + pub relatives: RelativeMovements, +} diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_book_settings_packet.rs b/azalea-protocol/src/packets/game/c_recipe_book_settings.rs index 1180bd26..f88a9733 100755 --- a/azalea-protocol/src/packets/game/clientbound_recipe_book_settings_packet.rs +++ b/azalea-protocol/src/packets/game/c_recipe_book_settings.rs @@ -1,12 +1,12 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRecipeBookSettingsPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRecipeBookSettings { pub book_settings: RecipeBookSettings, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct RecipeBookSettings { pub gui_open: bool, pub filtering_craftable: bool, diff --git a/azalea-protocol/src/packets/game/c_remove_entities.rs b/azalea-protocol/src/packets/game/c_remove_entities.rs new file mode 100755 index 00000000..f3eb7139 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_remove_entities.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRemoveEntities { + #[var] + pub entity_ids: Vec<u32>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs b/azalea-protocol/src/packets/game/c_remove_mob_effect.rs index 87bf81bd..21500db3 100755 --- a/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs +++ b/azalea-protocol/src/packets/game/c_remove_mob_effect.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRemoveMobEffectPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRemoveMobEffect { #[var] pub entity_id: u32, pub effect: azalea_registry::MobEffect, diff --git a/azalea-protocol/src/packets/game/c_reset_score.rs b/azalea-protocol/src/packets/game/c_reset_score.rs new file mode 100644 index 00000000..8a40dd0d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_reset_score.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundResetScore { + pub owner: String, + pub objective_name: Option<String>, +} diff --git a/azalea-protocol/src/packets/game/c_resource_pack_pop.rs b/azalea-protocol/src/packets/game/c_resource_pack_pop.rs new file mode 100644 index 00000000..14150ea1 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_resource_pack_pop.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundResourcePackPop { + pub id: Option<Uuid>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs b/azalea-protocol/src/packets/game/c_resource_pack_push.rs index 1d5e00b1..6e355029 100644 --- a/azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs +++ b/azalea-protocol/src/packets/game/c_resource_pack_push.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; use uuid::Uuid; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundResourcePackPushPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundResourcePackPush { pub id: Uuid, pub url: String, pub hash: String, diff --git a/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs b/azalea-protocol/src/packets/game/c_respawn.rs index 7e20a843..79bbfd1d 100755 --- a/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs +++ b/azalea-protocol/src/packets/game/c_respawn.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; use crate::packets::common::CommonPlayerSpawnInfo; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRespawnPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRespawn { pub common: CommonPlayerSpawnInfo, pub data_to_keep: u8, } diff --git a/azalea-protocol/src/packets/game/c_rotate_head.rs b/azalea-protocol/src/packets/game/c_rotate_head.rs new file mode 100755 index 00000000..26e55948 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_rotate_head.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRotateHead { + #[var] + pub entity_id: u32, + pub y_head_rot: i8, +} diff --git a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs b/azalea-protocol/src/packets/game/c_section_blocks_update.rs index e92ca422..4554c015 100755 --- a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs +++ b/azalea-protocol/src/packets/game/c_section_blocks_update.rs @@ -1,14 +1,12 @@ use std::io::{Cursor, Write}; use azalea_block::BlockState; -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_core::position::{ChunkSectionBlockPos, ChunkSectionPos}; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSectionBlocksUpdatePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSectionBlocksUpdate { pub section_pos: ChunkSectionPos, pub states: Vec<BlockStateWithPosition>, } @@ -19,9 +17,9 @@ pub struct BlockStateWithPosition { pub state: BlockState, } -impl McBufReadable for BlockStateWithPosition { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let data = u64::var_read_from(buf)?; +impl AzaleaRead for BlockStateWithPosition { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let data = u64::azalea_read_var(buf)?; let position_part = data & 4095; let state = (data >> 12) as u32; let state = BlockState::try_from(state) @@ -35,11 +33,11 @@ impl McBufReadable for BlockStateWithPosition { } } -impl McBufWritable for BlockStateWithPosition { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for BlockStateWithPosition { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let data = (self.state.id as u64) << 12 | (u64::from(self.pos.x) << 8 | u64::from(self.pos.z) << 4 | u64::from(self.pos.y)); - u64::var_write_into(&data, buf)?; + u64::azalea_write_var(&data, buf)?; Ok(()) } } diff --git a/azalea-protocol/src/packets/game/clientbound_select_advancements_tab_packet.rs b/azalea-protocol/src/packets/game/c_select_advancements_tab.rs index c0d5f2ee..eb4cc62a 100755 --- a/azalea-protocol/src/packets/game/clientbound_select_advancements_tab_packet.rs +++ b/azalea-protocol/src/packets/game/c_select_advancements_tab.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSelectAdvancementsTabPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSelectAdvancementsTab { pub tab: Option<ResourceLocation>, } diff --git a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs b/azalea-protocol/src/packets/game/c_server_data.rs index a70a0aec..22116685 100755 --- a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs +++ b/azalea-protocol/src/packets/game/c_server_data.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundServerDataPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundServerData { pub motd: FormattedText, pub icon_bytes: Option<Vec<u8>>, } diff --git a/azalea-protocol/src/packets/game/c_server_links.rs b/azalea-protocol/src/packets/game/c_server_links.rs new file mode 100644 index 00000000..80c444f0 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_server_links.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use crate::common::server_links::ServerLinkEntry; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundServerLinks { + pub links: Vec<ServerLinkEntry>, +} diff --git a/azalea-protocol/src/packets/game/c_set_action_bar_text.rs b/azalea-protocol/src/packets/game/c_set_action_bar_text.rs new file mode 100755 index 00000000..d08c5021 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_action_bar_text.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetActionBarText { + pub text: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_center.rs b/azalea-protocol/src/packets/game/c_set_border_center.rs new file mode 100755 index 00000000..afc49556 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_center.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderCenter { + pub new_center_x: f64, + pub new_center_z: f64, +} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_lerp_size_packet.rs b/azalea-protocol/src/packets/game/c_set_border_lerp_size.rs index 5c80e897..3c70a40e 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_border_lerp_size_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_border_lerp_size.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderLerpSizePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderLerpSize { pub old_size: f64, pub new_size: f64, #[var] diff --git a/azalea-protocol/src/packets/game/c_set_border_size.rs b/azalea-protocol/src/packets/game/c_set_border_size.rs new file mode 100755 index 00000000..6884cde6 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_size.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderSize { + pub size: f64, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_warning_delay.rs b/azalea-protocol/src/packets/game/c_set_border_warning_delay.rs new file mode 100755 index 00000000..e1126165 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_warning_delay.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderWarningDelay { + #[var] + pub warning_delay: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_warning_distance.rs b/azalea-protocol/src/packets/game/c_set_border_warning_distance.rs new file mode 100755 index 00000000..dbb2a742 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_warning_distance.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderWarningDistance { + #[var] + pub warning_blocks: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_camera.rs b/azalea-protocol/src/packets/game/c_set_camera.rs new file mode 100755 index 00000000..4ce4547c --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_camera.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetCamera { + #[var] + pub camera_id: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_chunk_cache_center.rs b/azalea-protocol/src/packets/game/c_set_chunk_cache_center.rs new file mode 100755 index 00000000..4c66213c --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_chunk_cache_center.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetChunkCacheCenter { + #[var] + pub x: i32, + #[var] + pub z: i32, +} diff --git a/azalea-protocol/src/packets/game/c_set_chunk_cache_radius.rs b/azalea-protocol/src/packets/game/c_set_chunk_cache_radius.rs new file mode 100755 index 00000000..b992e572 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_chunk_cache_radius.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetChunkCacheRadius { + #[var] + pub radius: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_cursor_item.rs b/azalea-protocol/src/packets/game/c_set_cursor_item.rs new file mode 100644 index 00000000..2c10ae26 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_cursor_item.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetCursorItem { + pub contents: Option<ItemStack>, +} diff --git a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs b/azalea-protocol/src/packets/game/c_set_default_spawn_position.rs index b45b645d..b6262ac8 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_default_spawn_position.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetDefaultSpawnPositionPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetDefaultSpawnPosition { pub pos: BlockPos, pub angle: f32, } diff --git a/azalea-protocol/src/packets/game/c_set_display_chat_preview.rs b/azalea-protocol/src/packets/game/c_set_display_chat_preview.rs new file mode 100755 index 00000000..df2a62d4 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_display_chat_preview.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetDisplayChatPreview { + pub enabled: bool, +} diff --git a/azalea-protocol/src/packets/game/clientbound_set_display_objective_packet.rs b/azalea-protocol/src/packets/game/c_set_display_objective.rs index 7e5ed317..12118772 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_display_objective_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_display_objective.rs @@ -1,13 +1,13 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetDisplayObjectivePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetDisplayObjective { pub slot: DisplaySlot, pub objective_name: String, } -#[derive(Clone, Debug, Copy, McBuf)] +#[derive(Clone, Debug, Copy, AzBuf)] pub enum DisplaySlot { List = 0, Sidebar, diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs b/azalea-protocol/src/packets/game/c_set_entity_data.rs index 7d869650..da6536fe 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_entity_data.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_entity::EntityMetadataItems; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEntityDataPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEntityData { #[var] pub id: u32, pub packed_items: EntityMetadataItems, diff --git a/azalea-protocol/src/packets/game/c_set_entity_link.rs b/azalea-protocol/src/packets/game/c_set_entity_link.rs new file mode 100755 index 00000000..c4ce8bdf --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_entity_link.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEntityLink { + pub source_id: u32, + pub dest_id: u32, +} diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_motion_packet.rs b/azalea-protocol/src/packets/game/c_set_entity_motion.rs index 4dcd807d..d0dd7698 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_motion_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_entity_motion.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEntityMotionPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEntityMotion { #[var] pub id: u32, pub xa: i16, diff --git a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs b/azalea-protocol/src/packets/game/c_set_equipment.rs index 165d05db..637b2b52 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_equipment.rs @@ -1,12 +1,12 @@ use std::io::Cursor; -use azalea_buf::{BufReadError, McBuf}; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_inventory::ItemSlot; +use azalea_buf::{AzBuf, BufReadError}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_inventory::ItemStack; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEquipmentPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEquipment { #[var] pub entity_id: u32, pub slots: EquipmentSlots, @@ -14,22 +14,22 @@ pub struct ClientboundSetEquipmentPacket { #[derive(Clone, Debug)] pub struct EquipmentSlots { - pub slots: Vec<(EquipmentSlot, ItemSlot)>, + pub slots: Vec<(EquipmentSlot, ItemStack)>, } -impl McBufReadable for EquipmentSlots { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { +impl AzaleaRead for EquipmentSlots { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let mut slots = vec![]; loop { - let equipment_byte = u8::read_from(buf)?; + let equipment_byte = u8::azalea_read(buf)?; let equipment_slot = EquipmentSlot::from_byte(equipment_byte & 127).ok_or_else(|| { BufReadError::UnexpectedEnumVariant { id: equipment_byte.into(), } })?; - let item = ItemSlot::read_from(buf)?; + let item = ItemStack::azalea_read(buf)?; slots.push((equipment_slot, item)); if equipment_byte & 128 == 0 { break; @@ -39,23 +39,23 @@ impl McBufReadable for EquipmentSlots { Ok(EquipmentSlots { slots }) } } -impl McBufWritable for EquipmentSlots { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for EquipmentSlots { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { for i in 0..self.slots.len() { let (equipment_slot, item) = &self.slots[i]; let mut equipment_byte = *equipment_slot as u8; if i != self.slots.len() - 1 { equipment_byte |= 128; } - equipment_byte.write_into(buf)?; - item.write_into(buf)?; + equipment_byte.azalea_write(buf)?; + item.azalea_write(buf)?; } Ok(()) } } -#[derive(Clone, Debug, Copy, McBuf)] +#[derive(Clone, Debug, Copy, AzBuf)] pub enum EquipmentSlot { MainHand = 0, OffHand = 1, diff --git a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs b/azalea-protocol/src/packets/game/c_set_experience.rs index f9590e26..c11482a0 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_experience.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetExperiencePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetExperience { pub experience_progress: f32, #[var] pub experience_level: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs b/azalea-protocol/src/packets/game/c_set_health.rs index 72b7554d..56f3fe03 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_health.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetHealthPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetHealth { pub health: f32, #[var] pub food: u32, diff --git a/azalea-protocol/src/packets/game/c_set_held_slot.rs b/azalea-protocol/src/packets/game/c_set_held_slot.rs new file mode 100644 index 00000000..81c21651 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_held_slot.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetHeldSlot { + pub slot: u8, +} diff --git a/azalea-protocol/src/packets/game/c_set_objective.rs b/azalea-protocol/src/packets/game/c_set_objective.rs new file mode 100755 index 00000000..7ddb3f71 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_objective.rs @@ -0,0 +1,82 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; +use azalea_chat::{numbers::NumberFormat, FormattedText}; +use azalea_core::objectives::ObjectiveCriteria; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetObjective { + pub objective_name: String, + pub method: Method, +} + +#[derive(Clone, Copy, Debug, AzBuf)] +pub enum MethodKind { + Add, + Remove, + Change, +} + +#[derive(Clone, Debug)] +pub enum Method { + Add { + display_name: FormattedText, + render_type: ObjectiveCriteria, + number_format: NumberFormat, + }, + Remove, + Change { + display_name: FormattedText, + render_type: ObjectiveCriteria, + number_format: NumberFormat, + }, +} + +impl AzaleaRead for Method { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { + let kind = MethodKind::azalea_read(buf)?; + match kind { + MethodKind::Add => Ok(Method::Add { + display_name: FormattedText::azalea_read(buf)?, + render_type: ObjectiveCriteria::azalea_read(buf)?, + number_format: NumberFormat::azalea_read(buf)?, + }), + MethodKind::Remove => Ok(Method::Remove), + MethodKind::Change => Ok(Method::Change { + display_name: FormattedText::azalea_read(buf)?, + render_type: ObjectiveCriteria::azalea_read(buf)?, + number_format: NumberFormat::azalea_read(buf)?, + }), + } + } +} + +impl AzaleaWrite for Method { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + Method::Add { + display_name, + render_type, + number_format, + } => { + MethodKind::Add.azalea_write(buf)?; + display_name.azalea_write(buf)?; + render_type.azalea_write(buf)?; + number_format.azalea_write(buf)?; + } + Method::Remove => MethodKind::Remove.azalea_write(buf)?, + Method::Change { + display_name, + render_type, + number_format, + } => { + MethodKind::Change.azalea_write(buf)?; + display_name.azalea_write(buf)?; + render_type.azalea_write(buf)?; + number_format.azalea_write(buf)?; + } + } + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_set_passengers_packet.rs b/azalea-protocol/src/packets/game/c_set_passengers.rs index ac337d6e..76fc3ca0 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_passengers_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_passengers.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetPassengersPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetPassengers { #[var] pub vehicle: u32, #[var] diff --git a/azalea-protocol/src/packets/game/c_set_player_inventory.rs b/azalea-protocol/src/packets/game/c_set_player_inventory.rs new file mode 100644 index 00000000..ca8955ee --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_player_inventory.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetPlayerInventory { + #[var] + pub slot: i32, + pub contents: Option<ItemStack>, +} diff --git a/azalea-protocol/src/packets/game/c_set_player_team.rs b/azalea-protocol/src/packets/game/c_set_player_team.rs new file mode 100755 index 00000000..38249cf3 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_player_team.rs @@ -0,0 +1,74 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_chat::{style::ChatFormatting, FormattedText}; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetPlayerTeam { + pub name: String, + pub method: Method, +} + +#[derive(Clone, Debug)] +pub enum Method { + Add((Parameters, PlayerList)), + Remove, + Change(Parameters), + Join(PlayerList), + Leave(PlayerList), +} + +impl AzaleaRead for Method { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + Ok(match u8::azalea_read(buf)? { + 0 => Method::Add((Parameters::azalea_read(buf)?, PlayerList::azalea_read(buf)?)), + 1 => Method::Remove, + 2 => Method::Change(Parameters::azalea_read(buf)?), + 3 => Method::Join(PlayerList::azalea_read(buf)?), + 4 => Method::Leave(PlayerList::azalea_read(buf)?), + id => return Err(BufReadError::UnexpectedEnumVariant { id: i32::from(id) }), + }) + } +} + +impl AzaleaWrite for Method { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + Method::Add((parameters, playerlist)) => { + 0u8.azalea_write(buf)?; + parameters.azalea_write(buf)?; + playerlist.azalea_write(buf)?; + } + Method::Remove => { + 1u8.azalea_write(buf)?; + } + Method::Change(parameters) => { + 2u8.azalea_write(buf)?; + parameters.azalea_write(buf)?; + } + Method::Join(playerlist) => { + 3u8.azalea_write(buf)?; + playerlist.azalea_write(buf)?; + } + Method::Leave(playerlist) => { + 4u8.azalea_write(buf)?; + playerlist.azalea_write(buf)?; + } + } + Ok(()) + } +} + +#[derive(AzBuf, Clone, Debug)] +pub struct Parameters { + pub display_name: FormattedText, + pub options: u8, + pub nametag_visibility: String, + pub collision_rule: String, + pub color: ChatFormatting, + pub player_prefix: FormattedText, + pub player_suffix: FormattedText, +} + +type PlayerList = Vec<String>; diff --git a/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs b/azalea-protocol/src/packets/game/c_set_score.rs index 6de53f74..5a16d134 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_score.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::{numbers::NumberFormat, FormattedText}; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetScorePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetScore { pub owner: String, pub objective_name: String, #[var] diff --git a/azalea-protocol/src/packets/game/c_set_simulation_distance.rs b/azalea-protocol/src/packets/game/c_set_simulation_distance.rs new file mode 100755 index 00000000..2a80d1f1 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_simulation_distance.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetSimulationDistance { + #[var] + pub simulation_distance: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_subtitle_text.rs b/azalea-protocol/src/packets/game/c_set_subtitle_text.rs new file mode 100755 index 00000000..31405739 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_subtitle_text.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetSubtitleText { + pub text: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs b/azalea-protocol/src/packets/game/c_set_time.rs index b73f082d..b1970eec 100755 --- a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs +++ b/azalea-protocol/src/packets/game/c_set_time.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetTimePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetTime { pub game_time: u64, pub day_time: u64, pub tick_day_time: bool, diff --git a/azalea-protocol/src/packets/game/c_set_title_text.rs b/azalea-protocol/src/packets/game/c_set_title_text.rs new file mode 100755 index 00000000..4ef3e590 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_title_text.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetTitleText { + pub text: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_set_titles_animation.rs b/azalea-protocol/src/packets/game/c_set_titles_animation.rs new file mode 100755 index 00000000..cc0c37fc --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_titles_animation.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetTitlesAnimation { + pub fade_in: u32, + pub stay: u32, + pub fade_out: u32, +} diff --git a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs b/azalea-protocol/src/packets/game/c_sound.rs index 4d2493ed..77161769 100755 --- a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs +++ b/azalea-protocol/src/packets/game/c_sound.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::SoundEvent; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSoundPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSound { pub sound: SoundEvent, pub source: SoundSource, pub x: i32, @@ -14,7 +14,7 @@ pub struct ClientboundSoundPacket { pub seed: u64, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum SoundSource { Master = 0, Music = 1, diff --git a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs b/azalea-protocol/src/packets/game/c_sound_entity.rs index 2e9252ae..96b22cb8 100755 --- a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs +++ b/azalea-protocol/src/packets/game/c_sound_entity.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSoundEntityPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSoundEntity { pub source: SoundSource, #[var] pub id: u32, @@ -12,7 +12,7 @@ pub struct ClientboundSoundEntityPacket { pub seed: u64, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum SoundSource { Master = 0, Music = 1, diff --git a/azalea-protocol/src/packets/game/c_start_configuration.rs b/azalea-protocol/src/packets/game/c_start_configuration.rs new file mode 100644 index 00000000..6955b70d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_start_configuration.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundStartConfiguration {} diff --git a/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs b/azalea-protocol/src/packets/game/c_stop_sound.rs index 48c80237..0a01fa71 100755 --- a/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs +++ b/azalea-protocol/src/packets/game/c_stop_sound.rs @@ -1,27 +1,27 @@ use std::io::{Cursor, Write}; -use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; +use azalea_buf::{BufReadError, AzaleaRead, AzaleaWrite}; use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; use azalea_protocol_macros::ClientboundGamePacket; -use super::clientbound_sound_packet::SoundSource; +use super::c_sound::SoundSource; #[derive(Clone, Debug, ClientboundGamePacket)] -pub struct ClientboundStopSoundPacket { +pub struct ClientboundStopSound { pub source: Option<SoundSource>, pub name: Option<ResourceLocation>, } -impl McBufReadable for ClientboundStopSoundPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let set = FixedBitSet::<2>::read_from(buf)?; +impl AzaleaRead for ClientboundStopSound { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let set = FixedBitSet::<2>::azalea_read(buf)?; let source = if set.index(0) { - Some(SoundSource::read_from(buf)?) + Some(SoundSource::azalea_read(buf)?) } else { None }; let name = if set.index(1) { - Some(ResourceLocation::read_from(buf)?) + Some(ResourceLocation::azalea_read(buf)?) } else { None }; @@ -30,8 +30,8 @@ impl McBufReadable for ClientboundStopSoundPacket { } } -impl McBufWritable for ClientboundStopSoundPacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for ClientboundStopSound { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<2>::new(); if self.source.is_some() { set.set(0); @@ -39,12 +39,12 @@ impl McBufWritable for ClientboundStopSoundPacket { if self.name.is_some() { set.set(1); } - set.write_into(buf)?; + set.azalea_write(buf)?; if let Some(source) = &self.source { - source.write_into(buf)?; + source.azalea_write(buf)?; } if let Some(name) = &self.name { - name.write_into(buf)?; + name.azalea_write(buf)?; } Ok(()) } diff --git a/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs b/azalea-protocol/src/packets/game/c_store_cookie.rs index 1c8ada28..a1deee4f 100644 --- a/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs +++ b/azalea-protocol/src/packets/game/c_store_cookie.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundStoreCookiePacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundStoreCookie { pub key: ResourceLocation, pub payload: Vec<u8>, } diff --git a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs b/azalea-protocol/src/packets/game/c_system_chat.rs index 691a62a1..14dfdcbf 100755 --- a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs +++ b/azalea-protocol/src/packets/game/c_system_chat.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)] -pub struct ClientboundSystemChatPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)] +pub struct ClientboundSystemChat { pub content: FormattedText, pub overlay: bool, } @@ -12,18 +12,18 @@ pub struct ClientboundSystemChatPacket { mod tests { use std::io::Cursor; - use azalea_buf::McBufReadable; + use azalea_buf::AzaleaRead; use super::*; #[test] - fn test_clientbound_system_chat_packet() { + fn test_c_system_chat_packet() { #[rustfmt::skip] let bytes = [ 10, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 2, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 3, 112, 121, 53, 11, 0, 2, 105, 100, 0, 0, 0, 4, 101, 54, 191, 237, 134, 149, 72, 253, 131, 161, 236, 210, 76, 242, 160, 253, 8, 0, 4, 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, 101, 0, 10, 47, 116, 101, 108, 108, 32, 112, 121, 53, 32, 0, 8, 0, 9, 105, 110, 115, 101, 114, 116, 105, 111, 110, 0, 3, 112, 121, 53, 8, 0, 4, 116, 101, 120, 116, 0, 3, 112, 121, 53, 0, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 1, 0, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 2, 105, 100, 0, 25, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 100, 105, 97, 109, 111, 110, 100, 95, 112, 105, 99, 107, 97, 120, 101, 8, 0, 3, 116, 97, 103, 0, 10, 123, 68, 97, 109, 97, 103, 101, 58, 48, 125, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 9, 115, 104, 111, 119, 95, 105, 116, 101, 109, 0, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 30, 105, 116, 101, 109, 46, 109, 105, 110, 101, 99, 114, 97, 102, 116, 46, 100, 105, 97, 109, 111, 110, 100, 95, 112, 105, 99, 107, 97, 120, 101, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 20, 99, 104, 97, 116, 46, 115, 113, 117, 97, 114, 101, 95, 98, 114, 97, 99, 107, 101, 116, 115, 0, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 3, 112, 121, 53, 11, 0, 2, 105, 100, 0, 0, 0, 4, 101, 54, 191, 237, 134, 149, 72, 253, 131, 161, 236, 210, 76, 242, 160, 253, 8, 0, 4, 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, 101, 0, 10, 47, 116, 101, 108, 108, 32, 112, 121, 53, 32, 0, 8, 0, 9, 105, 110, 115, 101, 114, 116, 105, 111, 110, 0, 3, 112, 121, 53, 8, 0, 4, 116, 101, 120, 116, 0, 3, 112, 121, 53, 0, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 28, 99, 111, 109, 109, 97, 110, 100, 115, 46, 103, 105, 118, 101, 46, 115, 117, 99, 99, 101, 115, 115, 46, 115, 105, 110, 103, 108, 101, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 1, 0, 6, 105, 116, 97, 108, 105, 99, 1, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 15, 99, 104, 97, 116, 46, 116, 121, 112, 101, 46, 97, 100, 109, 105, 110, 0, 0 ]; - let packet = ClientboundSystemChatPacket::read_from(&mut Cursor::new(&bytes)).unwrap(); + let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); assert_eq!( packet.content.to_string(), "[py5: Gave 1 [Diamond Pickaxe] to py5]".to_string() @@ -31,12 +31,12 @@ mod tests { } #[test] - fn test_translate_with_string_array_clientbound_system_chat_packet() { + fn test_translate_with_string_array_c_system_chat_packet() { #[rustfmt::skip] let bytes = [ 10, 9, 0, 4, 119, 105, 116, 104, 8, 0, 0, 0, 1, 0, 14, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 100, 117, 115, 116, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 25, 99, 111, 109, 109, 97, 110, 100, 115, 46, 112, 97, 114, 116, 105, 99, 108, 101, 46, 115, 117, 99, 99, 101, 115, 115, 0, 0 ]; - let packet = ClientboundSystemChatPacket::read_from(&mut Cursor::new(&bytes)).unwrap(); + let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); assert_eq!( packet.content.to_string(), "Displaying particle minecraft:dust".to_string() diff --git a/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs b/azalea-protocol/src/packets/game/c_tab_list.rs index 03557f5a..268351da 100755 --- a/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs +++ b/azalea-protocol/src/packets/game/c_tab_list.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTabListPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTabList { pub header: FormattedText, pub footer: FormattedText, } @@ -12,7 +12,7 @@ pub struct ClientboundTabListPacket { mod tests { use std::io::Cursor; - use azalea_buf::McBufReadable; + use azalea_buf::AzaleaRead; use super::*; @@ -22,7 +22,7 @@ mod tests { let mut bytes = Cursor::new(&[ 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 3, 1, 0, 4, 98, 111, 108, 100, 1, 8, 0, 4, 116, 101, 120, 116, 0, 16, 50, 66, 85, 73, 76, 68, 69, 82, 83, 50, 84, 79, 79, 76, 83, 10, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 0, 8, 0, 0, 0, 1, 10, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 27, 80, 101, 110, 100, 105, 110, 103, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 32, 116, 111, 32, 50, 98, 50, 116, 10, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 10, 0, 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 72, 84, 104, 105, 115, 32, 97, 99, 99, 111, 117, 110, 116, 32, 104, 97, 115, 32, 112, 114, 105, 111, 114, 105, 116, 121, 32, 115, 116, 97, 116, 117, 115, 32, 97, 110, 100, 32, 119, 105, 108, 108, 32, 98, 101, 32, 112, 108, 97, 99, 101, 100, 32, 105, 110, 32, 97, 32, 115, 104, 111, 114, 116, 101, 114, 32, 113, 117, 101, 117, 101, 46, 10, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 10, 0 ][..]); - let _packet = ClientboundTabListPacket::read_from(&mut bytes).unwrap(); + let _packet = ClientboundTabList::azalea_read(&mut bytes).unwrap(); assert!(bytes.get_ref()[bytes.position() as usize..].is_empty()); } } diff --git a/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs b/azalea-protocol/src/packets/game/c_tag_query.rs index d1073cd5..efd94e32 100755 --- a/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs +++ b/azalea-protocol/src/packets/game/c_tag_query.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; use simdnbt::owned::NbtTag; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTagQueryPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTagQuery { #[var] pub transaction_id: u32, pub tag: NbtTag, diff --git a/azalea-protocol/src/packets/game/clientbound_take_item_entity_packet.rs b/azalea-protocol/src/packets/game/c_take_item_entity.rs index 9e29a0fe..0dfc8552 100755 --- a/azalea-protocol/src/packets/game/clientbound_take_item_entity_packet.rs +++ b/azalea-protocol/src/packets/game/c_take_item_entity.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTakeItemEntityPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTakeItemEntity { #[var] pub item_id: u32, #[var] diff --git a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs b/azalea-protocol/src/packets/game/c_teleport_entity.rs index c8fbc718..0f026133 100755 --- a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs +++ b/azalea-protocol/src/packets/game/c_teleport_entity.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::Vec3; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTeleportEntityPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTeleportEntity { #[var] pub id: u32, pub position: Vec3, diff --git a/azalea-protocol/src/packets/game/c_ticking_state.rs b/azalea-protocol/src/packets/game/c_ticking_state.rs new file mode 100644 index 00000000..3e4e11c2 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_ticking_state.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTickingState { + pub tick_rate: f32, + pub is_frozen: bool, +} diff --git a/azalea-protocol/src/packets/game/c_ticking_step.rs b/azalea-protocol/src/packets/game/c_ticking_step.rs new file mode 100644 index 00000000..0a151134 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_ticking_step.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTickingStep { + #[var] + pub tick_steps: u32, +} diff --git a/azalea-protocol/src/packets/game/c_transfer.rs b/azalea-protocol/src/packets/game/c_transfer.rs new file mode 100644 index 00000000..ad7de333 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_transfer.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTransfer { + pub host: String, + #[var] + pub port: u32, +} diff --git a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs b/azalea-protocol/src/packets/game/c_update_advancements.rs index 5934b443..cd0c0b98 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs +++ b/azalea-protocol/src/packets/game/c_update_advancements.rs @@ -1,21 +1,21 @@ use std::collections::HashMap; use std::io::Cursor; -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_chat::FormattedText; use azalea_core::resource_location::ResourceLocation; -use azalea_inventory::ItemSlot; +use azalea_inventory::ItemStack; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateAdvancementsPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateAdvancements { pub reset: bool, pub added: Vec<AdvancementHolder>, pub removed: Vec<ResourceLocation>, pub progress: HashMap<ResourceLocation, AdvancementProgress>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct Advancement { pub parent_id: Option<ResourceLocation>, pub display: Option<DisplayInfo>, @@ -27,7 +27,7 @@ pub struct Advancement { pub struct DisplayInfo { pub title: FormattedText, pub description: FormattedText, - pub icon: ItemSlot, + pub icon: ItemStack, pub frame: FrameType, pub show_toast: bool, pub hidden: bool, @@ -36,12 +36,12 @@ pub struct DisplayInfo { pub y: f32, } -impl azalea_buf::McBufWritable for DisplayInfo { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - self.title.write_into(buf)?; - self.description.write_into(buf)?; - self.icon.write_into(buf)?; - self.frame.write_into(buf)?; +impl azalea_buf::AzaleaWrite for DisplayInfo { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + self.title.azalea_write(buf)?; + self.description.azalea_write(buf)?; + self.icon.azalea_write(buf)?; + self.frame.azalea_write(buf)?; let mut data: u32 = 0; if self.background.is_some() { @@ -53,35 +53,35 @@ impl azalea_buf::McBufWritable for DisplayInfo { if self.hidden { data |= 0b100; } - data.write_into(buf)?; + data.azalea_write(buf)?; if let Some(background) = &self.background { - background.write_into(buf)?; + background.azalea_write(buf)?; } - self.x.write_into(buf)?; - self.y.write_into(buf)?; + self.x.azalea_write(buf)?; + self.y.azalea_write(buf)?; Ok(()) } } -impl azalea_buf::McBufReadable for DisplayInfo { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { - let title = azalea_buf::McBufReadable::read_from(buf)?; - let description = azalea_buf::McBufReadable::read_from(buf)?; - let icon = azalea_buf::McBufReadable::read_from(buf)?; - let frame = azalea_buf::McBufReadable::read_from(buf)?; - - let data = u32::read_from(buf)?; +impl azalea_buf::AzaleaRead for DisplayInfo { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { + let title = azalea_buf::AzaleaRead::azalea_read(buf)?; + let description = azalea_buf::AzaleaRead::azalea_read(buf)?; + let icon = azalea_buf::AzaleaRead::azalea_read(buf)?; + let frame = azalea_buf::AzaleaRead::azalea_read(buf)?; + + let data = u32::azalea_read(buf)?; let has_background = (data & 0b1) != 0; let show_toast = (data & 0b10) != 0; let hidden = (data & 0b100) != 0; let background = if has_background { - Some(ResourceLocation::read_from(buf)?) + Some(ResourceLocation::azalea_read(buf)?) } else { None }; - let x = azalea_buf::McBufReadable::read_from(buf)?; - let y = azalea_buf::McBufReadable::read_from(buf)?; + let x = azalea_buf::AzaleaRead::azalea_read(buf)?; + let y = azalea_buf::AzaleaRead::azalea_read(buf)?; Ok(DisplayInfo { title, description, @@ -96,7 +96,7 @@ impl azalea_buf::McBufReadable for DisplayInfo { } } -#[derive(Clone, Debug, Copy, McBuf)] +#[derive(Clone, Debug, Copy, AzBuf)] pub enum FrameType { Task = 0, Challenge = 1, @@ -105,12 +105,12 @@ pub enum FrameType { pub type AdvancementProgress = HashMap<String, CriterionProgress>; -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct CriterionProgress { pub date: Option<u64>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct AdvancementHolder { pub id: ResourceLocation, pub value: Advancement, @@ -118,13 +118,13 @@ pub struct AdvancementHolder { #[cfg(test)] mod tests { - use azalea_buf::{McBufReadable, McBufWritable}; + use azalea_buf::{AzaleaRead, AzaleaWrite}; use super::*; #[test] fn test() { - let packet = ClientboundUpdateAdvancementsPacket { + let packet = ClientboundUpdateAdvancements { reset: true, added: [AdvancementHolder { id: ResourceLocation::new("minecraft:test"), @@ -133,7 +133,7 @@ mod tests { display: Some(DisplayInfo { title: FormattedText::from("title".to_string()), description: FormattedText::from("description".to_string()), - icon: ItemSlot::Empty, + icon: ItemStack::Empty, frame: FrameType::Task, show_toast: true, hidden: false, @@ -164,10 +164,10 @@ mod tests { }; let mut data = Vec::new(); - packet.write_into(&mut data).unwrap(); + packet.azalea_write(&mut data).unwrap(); let mut buf: Cursor<&[u8]> = Cursor::new(&data); - let read_packet = ClientboundUpdateAdvancementsPacket::read_from(&mut buf).unwrap(); + let read_packet = ClientboundUpdateAdvancements::azalea_read(&mut buf).unwrap(); assert_eq!(packet.reset, read_packet.reset); assert_eq!(packet.removed, read_packet.removed); diff --git a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs b/azalea-protocol/src/packets/game/c_update_attributes.rs index 19d4a715..2b800643 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs +++ b/azalea-protocol/src/packets/game/c_update_attributes.rs @@ -1,16 +1,16 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_entity::attributes::AttributeModifier; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::Attribute; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateAttributesPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateAttributes { #[var] pub entity_id: u32, pub values: Vec<AttributeSnapshot>, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct AttributeSnapshot { pub attribute: Attribute, pub base: f64, diff --git a/azalea-protocol/src/packets/game/clientbound_update_enabled_features_packet.rs b/azalea-protocol/src/packets/game/c_update_enabled_features.rs index e08358f7..d4dac483 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_enabled_features_packet.rs +++ b/azalea-protocol/src/packets/game/c_update_enabled_features.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ClientboundGamePacket; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateEnabledFeaturesPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateEnabledFeatures { pub features: Vec<ResourceLocation>, } diff --git a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs b/azalea-protocol/src/packets/game/c_update_mob_effect.rs index 5c7abf3a..6a31ccab 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs +++ b/azalea-protocol/src/packets/game/c_update_mob_effect.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::MobEffect; -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateMobEffectPacket { +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateMobEffect { #[var] pub entity_id: u32, pub mob_effect: MobEffect, diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/c_update_recipes.rs index 4c950f90..38c4f37b 100755 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/c_update_recipes.rs @@ -1,33 +1,33 @@ use std::collections::HashMap; -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; -use azalea_inventory::ItemSlot; +use azalea_inventory::ItemStack; use azalea_protocol_macros::ClientboundGamePacket; use azalea_registry::HolderSet; -#[derive(Clone, Debug, PartialEq, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateRecipesPacket { +#[derive(Clone, Debug, PartialEq, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateRecipes { pub item_sets: HashMap<ResourceLocation, RecipePropertySet>, pub stonecutter_recipes: Vec<SingleInputEntry>, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct SingleInputEntry { pub input: Ingredient, pub recipe: SelectableRecipe, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct SelectableRecipe { pub option_display: SlotDisplayData, } /// [`azalea_registry::SlotDisplay`] -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub enum SlotDisplayData { Empty, AnyFuel, - Item(ItemSlotDisplay), + Item(ItemStackDisplay), ItemStack(ItemStackSlotDisplay), Tag(ResourceLocation), SmithingTrim(Box<SmithingTrimDemoSlotDisplay>), @@ -35,40 +35,40 @@ pub enum SlotDisplayData { Composite(CompositeSlotDisplay), } -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct ItemSlotDisplay { +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct ItemStackDisplay { pub item: azalea_registry::Item, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct ItemStackSlotDisplay { - pub stack: ItemSlot, + pub stack: ItemStack, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct TagSlotDisplay { pub tag: azalea_registry::Item, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct SmithingTrimDemoSlotDisplay { pub base: SlotDisplayData, pub material: SlotDisplayData, pub pattern: SlotDisplayData, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct WithRemainderSlotDisplay { pub input: SlotDisplayData, pub remainder: SlotDisplayData, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct CompositeSlotDisplay { pub contents: Vec<SlotDisplayData>, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct RecipePropertySet { pub items: Vec<azalea_registry::Item>, } -#[derive(Clone, Debug, PartialEq, McBuf)] +#[derive(Clone, Debug, PartialEq, AzBuf)] pub struct Ingredient { pub allowed: HolderSet<azalea_registry::Item, ResourceLocation>, } diff --git a/azalea-protocol/src/packets/game/c_update_tags.rs b/azalea-protocol/src/packets/game/c_update_tags.rs new file mode 100755 index 00000000..4b63ec8f --- /dev/null +++ b/azalea-protocol/src/packets/game/c_update_tags.rs @@ -0,0 +1,74 @@ +use std::io::Cursor; +use std::ops::Deref; +use std::{collections::HashMap, io::Write}; + +use azalea_buf::{AzBuf, AzaleaReadVar, AzaleaWriteVar, BufReadError}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateTags { + pub tags: TagMap, +} + +#[derive(Clone, Debug)] +pub struct Tags { + pub name: ResourceLocation, + pub elements: Vec<i32>, +} + +#[derive(Clone, Debug)] +pub struct TagMap(pub HashMap<ResourceLocation, Vec<Tags>>); + +impl AzaleaRead for TagMap { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let length = u32::azalea_read_var(buf)? as usize; + let mut data = HashMap::with_capacity(length); + for _ in 0..length { + let tag_type = ResourceLocation::azalea_read(buf)?; + let tags_count = i32::azalea_read_var(buf)? as usize; + let mut tags_vec = Vec::with_capacity(tags_count); + for _ in 0..tags_count { + let tags = Tags::azalea_read(buf)?; + tags_vec.push(tags); + } + data.insert(tag_type, tags_vec); + } + Ok(TagMap(data)) + } +} + +impl AzaleaWrite for TagMap { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + (self.len() as u32).azalea_write_var(buf)?; + for (k, v) in &self.0 { + k.azalea_write(buf)?; + v.azalea_write(buf)?; + } + Ok(()) + } +} +impl AzaleaRead for Tags { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let name = ResourceLocation::azalea_read(buf)?; + let elements = Vec::<i32>::azalea_read_var(buf)?; + Ok(Tags { name, elements }) + } +} + +impl AzaleaWrite for Tags { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.name.azalea_write(buf)?; + self.elements.azalea_write_var(buf)?; + Ok(()) + } +} + +impl Deref for TagMap { + type Target = HashMap<ResourceLocation, Vec<Tags>>; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs deleted file mode 100755 index e9e57c8d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockChangedAckPacket { - #[var] - pub sequence: i32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs b/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs deleted file mode 100644 index cad2eca3..00000000 --- a/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBundlePacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_chunk_batch_finished_packet.rs b/azalea-protocol/src/packets/game/clientbound_chunk_batch_finished_packet.rs deleted file mode 100644 index 27bc2f25..00000000 --- a/azalea-protocol/src/packets/game/clientbound_chunk_batch_finished_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChunkBatchFinishedPacket { - #[var] - pub batch_size: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_chunk_batch_start_packet.rs b/azalea-protocol/src/packets/game/clientbound_chunk_batch_start_packet.rs deleted file mode 100644 index 308ba8c9..00000000 --- a/azalea-protocol/src/packets/game/clientbound_chunk_batch_start_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChunkBatchStartPacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_clear_titles_packet.rs b/azalea-protocol/src/packets/game/clientbound_clear_titles_packet.rs deleted file mode 100644 index 3bdc0c79..00000000 --- a/azalea-protocol/src/packets/game/clientbound_clear_titles_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundClearTitlesPacket { - pub reset_times: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs deleted file mode 100644 index a59da450..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerClosePacket { - pub container_id: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs deleted file mode 100755 index 4e08232d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerSetContentPacket { - pub container_id: i8, - #[var] - pub state_id: u32, - pub items: Vec<ItemSlot>, - pub carried_item: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs deleted file mode 100755 index dc53a024..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerSetDataPacket { - pub container_id: i8, - pub id: u16, - pub value: u16, -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs deleted file mode 100755 index 9b954fa0..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerSetSlotPacket { - pub container_id: i8, - #[var] - pub state_id: u32, - pub slot: u16, - pub item_stack: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs deleted file mode 100644 index cf5d369a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; -use azalea_core::position::Vec3; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundDamageEventPacket { - #[var] - pub entity_id: u32, - #[var] - pub source_type_id: u32, - pub source_cause_id: OptionalEntityId, - pub source_direct_id: OptionalEntityId, - pub source_position: Option<Vec3>, -} - -#[derive(Clone, Debug)] -pub struct OptionalEntityId(pub Option<u32>); -impl McBufReadable for OptionalEntityId { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> { - match u32::var_read_from(buf)? { - 0 => Ok(OptionalEntityId(None)), - id => Ok(OptionalEntityId(Some(id - 1))), - } - } -} -impl McBufWritable for OptionalEntityId { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self.0 { - Some(id) => (id + 1).var_write_into(buf), - None => 0u32.var_write_into(buf), - } - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs b/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs deleted file mode 100755 index 641fd05e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -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_delete_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs deleted file mode 100755 index eef9b561..00000000 --- a/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::clientbound_player_chat_packet::PackedMessageSignature; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundDeleteChatPacket { - pub signature: PackedMessageSignature, -} diff --git a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs deleted file mode 100755 index f8771c37..00000000 --- a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundDisconnectPacket { - pub reason: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs deleted file mode 100755 index 18076a33..00000000 --- a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundEntityEventPacket { - pub entity_id: u32, - pub event_id: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_forget_level_chunk_packet.rs b/azalea-protocol/src/packets/game/clientbound_forget_level_chunk_packet.rs deleted file mode 100755 index 027d41ee..00000000 --- a/azalea-protocol/src/packets/game/clientbound_forget_level_chunk_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::ChunkPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundForgetLevelChunkPacket { - pub pos: ChunkPos, -} diff --git a/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs b/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs deleted file mode 100644 index d4a79a27..00000000 --- a/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundHurtAnimationPacket { - #[var] - pub id: u32, - pub yaw: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs deleted file mode 100755 index 16fe3357..00000000 --- a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundKeepAlivePacket { - pub id: u64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs deleted file mode 100755 index 1b450b80..00000000 --- a/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::serverbound_interact_packet::InteractionHand; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundOpenBookPacket { - pub hand: InteractionHand, -} diff --git a/azalea-protocol/src/packets/game/clientbound_ping_packet.rs b/azalea-protocol/src/packets/game/clientbound_ping_packet.rs deleted file mode 100755 index 0bd2c8c3..00000000 --- a/azalea-protocol/src/packets/game/clientbound_ping_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPingPacket { - pub id: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs deleted file mode 100644 index 9cd20efc..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs +++ /dev/null @@ -1,202 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_chat::{ - translatable_component::{StringOrComponent, TranslatableComponent}, - FormattedText, -}; -use azalea_core::bitset::BitSet; -use azalea_crypto::MessageSignature; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)] -pub struct ClientboundPlayerChatPacket { - pub sender: Uuid, - #[var] - pub index: u32, - pub signature: Option<MessageSignature>, - pub body: PackedSignedMessageBody, - pub unsigned_content: Option<FormattedText>, - pub filter_mask: FilterMask, - pub chat_type: ChatTypeBound, -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct PackedSignedMessageBody { - // the error is here, for some reason it skipped a byte earlier and here - // it's reading `0` when it should be `11` - pub content: String, - pub timestamp: u64, - pub salt: u64, - pub last_seen: PackedLastSeenMessages, -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct PackedLastSeenMessages { - pub entries: Vec<PackedMessageSignature>, -} - -/// Messages can be deleted by either their signature or message id. -#[derive(Clone, Debug, PartialEq)] -pub enum PackedMessageSignature { - Signature(Box<MessageSignature>), - Id(u32), -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub enum FilterMask { - PassThrough, - FullyFiltered, - PartiallyFiltered(BitSet), -} - -#[derive(Copy, Clone, Debug, McBuf, PartialEq, Eq)] -pub enum ChatType { - Chat = 0, - SayCommand = 1, - MsgCommandIncoming = 2, - MsgCommandOutgoing = 3, - TeamMsgCommandIncoming = 4, - TeamMsgCommandOutgoing = 5, - EmoteCommand = 6, -} - -#[derive(Clone, Debug, McBuf, PartialEq)] -pub struct ChatTypeBound { - pub chat_type: ChatType, - pub name: FormattedText, - pub target_name: Option<FormattedText>, -} - -// must be in Client -#[derive(Clone, Debug, PartialEq)] -pub struct MessageSignatureCache { - pub entries: Vec<Option<MessageSignature>>, -} - -// impl MessageSignatureCache { -// pub fn unpacker(&self) -> impl Fn(u32) -> Option<SignedMessageBody> { - -// } -// } - -// impl PackedSignedMessageBody { -// pub fn unpack(&self, unpacker: impl Fn(u32) -> Option<SignedMessageBody>) -// {} } - -impl ClientboundPlayerChatPacket { - /// Returns the content of the message. If you want to get the FormattedText - /// for the whole message including the sender part, use - /// [`ClientboundPlayerChatPacket::message`]. - #[must_use] - pub fn content(&self) -> FormattedText { - self.unsigned_content - .clone() - .unwrap_or_else(|| FormattedText::from(self.body.content.clone())) - } - - /// Get the full message, including the sender part. - #[must_use] - pub fn message(&self) -> FormattedText { - let sender = self.chat_type.name.clone(); - let content = self.content(); - let target = self.chat_type.target_name.clone(); - - let translation_key = self.chat_type.chat_type.chat_translation_key(); - - let mut args = vec![ - StringOrComponent::FormattedText(sender), - StringOrComponent::FormattedText(content), - ]; - if let Some(target) = target { - args.push(StringOrComponent::FormattedText(target)); - } - - let component = TranslatableComponent::new(translation_key.to_string(), args); - - FormattedText::Translatable(component) - } -} - -impl ChatType { - #[must_use] - pub fn chat_translation_key(&self) -> &'static str { - match self { - ChatType::Chat => "chat.type.text", - ChatType::SayCommand => "chat.type.announcement", - ChatType::MsgCommandIncoming => "commands.message.display.incoming", - ChatType::MsgCommandOutgoing => "commands.message.display.outgoing", - ChatType::TeamMsgCommandIncoming => "chat.type.team.text", - ChatType::TeamMsgCommandOutgoing => "chat.type.team.sent", - ChatType::EmoteCommand => "chat.type.emote", - } - } - - #[must_use] - pub fn narrator_translation_key(&self) -> &'static str { - match self { - ChatType::EmoteCommand => "chat.type.emote", - _ => "chat.type.text.narrate", - } - } -} - -impl McBufReadable for PackedMessageSignature { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let id = u32::var_read_from(buf)?; - if id == 0 { - let full_signature = MessageSignature::read_from(buf)?; - - Ok(PackedMessageSignature::Signature(Box::new(full_signature))) - } else { - Ok(PackedMessageSignature::Id(id - 1)) - } - } -} -impl McBufWritable for PackedMessageSignature { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - PackedMessageSignature::Signature(full_signature) => { - 0u32.var_write_into(buf)?; - full_signature.write_into(buf)?; - } - PackedMessageSignature::Id(id) => { - (id + 1).var_write_into(buf)?; - } - } - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_read_player_chat_packet() { - let mut bytes = Cursor::new( - &[ - 55, 186, 28, 76, 92, 167, 177, 75, 188, 158, 200, 179, 191, 227, 16, 171, 145, 0, - 0, 4, 116, 101, 115, 116, 0, 0, 1, 140, 178, 225, 89, 103, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 10, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, - 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 12, 75, - 97, 115, 117, 109, 105, 77, 97, 114, 105, 115, 97, 11, 0, 2, 105, 100, 0, 0, 0, 4, - 186, 28, 76, 92, 167, 177, 75, 188, 158, 200, 179, 191, 227, 16, 171, 145, 8, 0, 4, - 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, - 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, - 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, - 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, - 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, - 101, 0, 19, 47, 116, 101, 108, 108, 32, 75, 97, 115, 117, 109, 105, 77, 97, 114, - 105, 115, 97, 32, 0, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 3, 0, 0, 0, 12, - 75, 97, 115, 117, 109, 105, 77, 97, 114, 105, 115, 97, 0, 0, 8, 0, 9, 105, 110, - 115, 101, 114, 116, 105, 111, 110, 0, 12, 75, 97, 115, 117, 109, 105, 77, 97, 114, - 105, 115, 97, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0, - ][..], - ); - let _packet = ClientboundPlayerChatPacket::read_from(&mut bytes).unwrap(); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs deleted file mode 100755 index 42ee1838..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs +++ /dev/null @@ -1,6 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -/// Unused in vanilla. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerCombatEnterPacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_remove_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_remove_packet.rs deleted file mode 100644 index bb620272..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_info_remove_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerInfoRemovePacket { - pub profile_ids: Vec<Uuid>, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_rotation_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_rotation_packet.rs deleted file mode 100755 index a1ad9bbe..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_rotation_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerRotationPacket { - pub y_rot: f32, - pub x_rot: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_pong_response_packet.rs b/azalea-protocol/src/packets/game/clientbound_pong_response_packet.rs deleted file mode 100755 index 0b48198e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_pong_response_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPongResponsePacket { - pub time: u64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_projectile_power_packet.rs b/azalea-protocol/src/packets/game/clientbound_projectile_power_packet.rs deleted file mode 100644 index a665a2aa..00000000 --- a/azalea-protocol/src/packets/game/clientbound_projectile_power_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundProjectilePowerPacket { - pub id: u32, - pub acceleration_power: f64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_book_remove_packet.rs b/azalea-protocol/src/packets/game/clientbound_recipe_book_remove_packet.rs deleted file mode 100755 index 678537ca..00000000 --- a/azalea-protocol/src/packets/game/clientbound_recipe_book_remove_packet.rs +++ /dev/null @@ -1,15 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::{ - clientbound_entity_position_sync_packet::PositionMoveRotation, - clientbound_player_position_packet::RelativeMovements, -}; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRecipeBookRemovePacket { - #[var] - pub id: u32, - pub change: PositionMoveRotation, - pub relatives: RelativeMovements, -} diff --git a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs b/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs deleted file mode 100755 index 7b192333..00000000 --- a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRemoveEntitiesPacket { - #[var] - pub entity_ids: Vec<u32>, -} diff --git a/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs b/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs deleted file mode 100644 index 8b24bbdf..00000000 --- a/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 34836c85..00000000 --- a/azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -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_rotate_head_packet.rs b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs deleted file mode 100755 index 2bc77540..00000000 --- a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRotateHeadPacket { - #[var] - pub entity_id: u32, - pub y_head_rot: i8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_server_links_packet.rs b/azalea-protocol/src/packets/game/clientbound_server_links_packet.rs deleted file mode 100644 index 4b24a519..00000000 --- a/azalea-protocol/src/packets/game/clientbound_server_links_packet.rs +++ /dev/null @@ -1,34 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundServerLinksPacket { - pub links: Vec<ServerLinkEntry>, -} - -#[derive(Clone, Debug, McBuf)] -pub struct ServerLinkEntry { - pub kind: ServerLinkKind, - pub link: String, -} - -#[derive(Clone, Debug, McBuf)] -pub enum ServerLinkKind { - Known(KnownLinkKind), - Component(FormattedText), -} - -#[derive(Clone, Copy, Debug, McBuf)] -pub enum KnownLinkKind { - BugReport, - CommunityGuidelines, - Support, - Status, - Feedback, - Community, - Website, - Forums, - News, - Announcements, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs deleted file mode 100755 index 60b80fe9..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetActionBarTextPacket { - pub text: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_center_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_center_packet.rs deleted file mode 100755 index d210b0ce..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_center_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderCenterPacket { - pub new_center_x: f64, - pub new_center_z: f64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_size_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_size_packet.rs deleted file mode 100755 index 3a86a720..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_size_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderSizePacket { - pub size: f64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_warning_delay_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_warning_delay_packet.rs deleted file mode 100755 index 4bf794ac..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_warning_delay_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderWarningDelayPacket { - #[var] - pub warning_delay: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_warning_distance_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_warning_distance_packet.rs deleted file mode 100755 index ef1b6e17..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_warning_distance_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderWarningDistancePacket { - #[var] - pub warning_blocks: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_camera_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_camera_packet.rs deleted file mode 100755 index 9da75dc7..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_camera_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetCameraPacket { - #[var] - pub camera_id: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs deleted file mode 100755 index e9aecba9..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetChunkCacheCenterPacket { - #[var] - pub x: i32, - #[var] - pub z: i32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_radius_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_radius_packet.rs deleted file mode 100755 index 9718ca56..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_radius_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetChunkCacheRadiusPacket { - #[var] - pub radius: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_cursor_item_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_cursor_item_packet.rs deleted file mode 100644 index 6a67b71c..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_cursor_item_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetCursorItemPacket { - pub contents: Option<ItemSlot>, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs deleted file mode 100755 index 5aee614e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetDisplayChatPreviewPacket { - pub enabled: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs deleted file mode 100755 index ac9dd944..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEntityLinkPacket { - pub source_id: u32, - pub dest_id: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_held_slot_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_held_slot_packet.rs deleted file mode 100644 index a83ae3cb..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_held_slot_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetHeldSlotPacket { - pub slot: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs deleted file mode 100755 index a9481ad1..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs +++ /dev/null @@ -1,82 +0,0 @@ -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 { - display_name: FormattedText, - render_type: ObjectiveCriteria, - number_format: NumberFormat, - }, - Remove, - Change { - display_name: FormattedText, - render_type: ObjectiveCriteria, - number_format: NumberFormat, - }, -} - -impl McBufReadable for Method { - 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 { - 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::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(()) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_player_inventory_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_player_inventory_packet.rs deleted file mode 100644 index c17fd310..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_player_inventory_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetPlayerInventoryPacket { - #[var] - pub slot: i32, - pub contents: Option<ItemSlot>, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs deleted file mode 100755 index 724b86aa..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use azalea_chat::{style::ChatFormatting, FormattedText}; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetPlayerTeamPacket { - pub name: String, - pub method: Method, -} - -#[derive(Clone, Debug)] -pub enum Method { - Add((Parameters, PlayerList)), - Remove, - Change(Parameters), - Join(PlayerList), - Leave(PlayerList), -} - -impl McBufReadable for Method { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - Ok(match u8::read_from(buf)? { - 0 => Method::Add((Parameters::read_from(buf)?, PlayerList::read_from(buf)?)), - 1 => Method::Remove, - 2 => Method::Change(Parameters::read_from(buf)?), - 3 => Method::Join(PlayerList::read_from(buf)?), - 4 => Method::Leave(PlayerList::read_from(buf)?), - id => return Err(BufReadError::UnexpectedEnumVariant { id: i32::from(id) }), - }) - } -} - -impl McBufWritable for Method { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - Method::Add((parameters, playerlist)) => { - 0u8.write_into(buf)?; - parameters.write_into(buf)?; - playerlist.write_into(buf)?; - } - Method::Remove => { - 1u8.write_into(buf)?; - } - Method::Change(parameters) => { - 2u8.write_into(buf)?; - parameters.write_into(buf)?; - } - Method::Join(playerlist) => { - 3u8.write_into(buf)?; - playerlist.write_into(buf)?; - } - Method::Leave(playerlist) => { - 4u8.write_into(buf)?; - playerlist.write_into(buf)?; - } - } - Ok(()) - } -} - -#[derive(McBuf, Clone, Debug)] -pub struct Parameters { - pub display_name: FormattedText, - pub options: u8, - pub nametag_visibility: String, - pub collision_rule: String, - pub color: ChatFormatting, - pub player_prefix: FormattedText, - pub player_suffix: FormattedText, -} - -type PlayerList = Vec<String>; diff --git a/azalea-protocol/src/packets/game/clientbound_set_simulation_distance_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_simulation_distance_packet.rs deleted file mode 100755 index 3efd1fa6..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_simulation_distance_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetSimulationDistancePacket { - #[var] - pub simulation_distance: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs deleted file mode 100755 index 9b25ac05..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetSubtitleTextPacket { - pub text: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs deleted file mode 100755 index fb00a4e5..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetTitleTextPacket { - pub text: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_titles_animation_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_titles_animation_packet.rs deleted file mode 100755 index 06faeb3c..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_titles_animation_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetTitlesAnimationPacket { - pub fade_in: u32, - pub stay: u32, - pub fade_out: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_start_configuration_packet.rs b/azalea-protocol/src/packets/game/clientbound_start_configuration_packet.rs deleted file mode 100644 index b6ad9615..00000000 --- a/azalea-protocol/src/packets/game/clientbound_start_configuration_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundStartConfigurationPacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs b/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs deleted file mode 100644 index a85429a2..00000000 --- a/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 5a5e6440..00000000 --- a/azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -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_transfer_packet.rs b/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs deleted file mode 100644 index dbce36e0..00000000 --- a/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -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_tags_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs deleted file mode 100755 index bcdef64a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::io::Cursor; -use std::ops::Deref; -use std::{collections::HashMap, io::Write}; - -use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable}; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateTagsPacket { - pub tags: TagMap, -} - -#[derive(Clone, Debug)] -pub struct Tags { - pub name: ResourceLocation, - pub elements: Vec<i32>, -} - -#[derive(Clone, Debug)] -pub struct TagMap(pub HashMap<ResourceLocation, Vec<Tags>>); - -impl McBufReadable for TagMap { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let length = u32::var_read_from(buf)? as usize; - let mut data = HashMap::with_capacity(length); - for _ in 0..length { - let tag_type = ResourceLocation::read_from(buf)?; - let tags_count = i32::var_read_from(buf)? as usize; - let mut tags_vec = Vec::with_capacity(tags_count); - for _ in 0..tags_count { - let tags = Tags::read_from(buf)?; - tags_vec.push(tags); - } - data.insert(tag_type, tags_vec); - } - Ok(TagMap(data)) - } -} - -impl McBufWritable for TagMap { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - (self.len() as u32).var_write_into(buf)?; - for (k, v) in &self.0 { - k.write_into(buf)?; - v.write_into(buf)?; - } - Ok(()) - } -} -impl McBufReadable for Tags { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let name = ResourceLocation::read_from(buf)?; - let elements = Vec::<i32>::var_read_from(buf)?; - Ok(Tags { name, elements }) - } -} - -impl McBufWritable for Tags { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.name.write_into(buf)?; - self.elements.var_write_into(buf)?; - Ok(()) - } -} - -impl Deref for TagMap { - type Target = HashMap<ResourceLocation, Vec<Tags>>; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index 55d6faaf..757dd27f 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -1,394 +1,202 @@ -pub mod clientbound_add_entity_packet; -pub mod clientbound_add_experience_orb_packet; -pub mod clientbound_animate_packet; -pub mod clientbound_award_stats_packet; -pub mod clientbound_block_changed_ack_packet; -pub mod clientbound_block_destruction_packet; -pub mod clientbound_block_entity_data_packet; -pub mod clientbound_block_event_packet; -pub mod clientbound_block_update_packet; -pub mod clientbound_boss_event_packet; -pub mod clientbound_bundle_packet; -pub mod clientbound_change_difficulty_packet; -pub mod clientbound_chunk_batch_finished_packet; -pub mod clientbound_chunk_batch_start_packet; -pub mod clientbound_chunks_biomes_packet; -pub mod clientbound_clear_titles_packet; -pub mod clientbound_command_suggestions_packet; -pub mod clientbound_commands_packet; -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_custom_report_details_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; -pub mod clientbound_entity_event_packet; -pub mod clientbound_entity_position_sync_packet; -pub mod clientbound_explode_packet; -pub mod clientbound_forget_level_chunk_packet; -pub mod clientbound_game_event_packet; -pub mod clientbound_horse_screen_open_packet; -pub mod clientbound_hurt_animation_packet; -pub mod clientbound_initialize_border_packet; -pub mod clientbound_keep_alive_packet; -pub mod clientbound_level_chunk_with_light_packet; -pub mod clientbound_level_event_packet; -pub mod clientbound_level_particles_packet; -pub mod clientbound_light_update_packet; -pub mod clientbound_login_packet; -pub mod clientbound_map_item_data_packet; -pub mod clientbound_merchant_offers_packet; -pub mod clientbound_move_entity_pos_packet; -pub mod clientbound_move_entity_pos_rot_packet; -pub mod clientbound_move_entity_rot_packet; -pub mod clientbound_move_minecart_packet; -pub mod clientbound_move_vehicle_packet; -pub mod clientbound_open_book_packet; -pub mod clientbound_open_screen_packet; -pub mod clientbound_open_sign_editor_packet; -pub mod clientbound_ping_packet; -pub mod clientbound_place_ghost_recipe_packet; -pub mod clientbound_player_abilities_packet; -pub mod clientbound_player_chat_packet; -pub mod clientbound_player_combat_end_packet; -pub mod clientbound_player_combat_enter_packet; -pub mod clientbound_player_combat_kill_packet; -pub mod clientbound_player_info_remove_packet; -pub mod clientbound_player_info_update_packet; -pub mod clientbound_player_look_at_packet; -pub mod clientbound_player_position_packet; -pub mod clientbound_player_rotation_packet; -pub mod clientbound_pong_response_packet; -pub mod clientbound_projectile_power_packet; -pub mod clientbound_recipe_book_add_packet; -pub mod clientbound_recipe_book_remove_packet; -pub mod clientbound_recipe_book_settings_packet; -pub mod clientbound_remove_entities_packet; -pub mod clientbound_remove_mob_effect_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; -pub mod clientbound_select_advancements_tab_packet; -pub mod clientbound_server_data_packet; -pub mod clientbound_server_links_packet; -pub mod clientbound_set_action_bar_text_packet; -pub mod clientbound_set_border_center_packet; -pub mod clientbound_set_border_lerp_size_packet; -pub mod clientbound_set_border_size_packet; -pub mod clientbound_set_border_warning_delay_packet; -pub mod clientbound_set_border_warning_distance_packet; -pub mod clientbound_set_camera_packet; -pub mod clientbound_set_chunk_cache_center_packet; -pub mod clientbound_set_chunk_cache_radius_packet; -pub mod clientbound_set_cursor_item_packet; -pub mod clientbound_set_default_spawn_position_packet; -pub mod clientbound_set_display_objective_packet; -pub mod clientbound_set_entity_data_packet; -pub mod clientbound_set_entity_link_packet; -pub mod clientbound_set_entity_motion_packet; -pub mod clientbound_set_equipment_packet; -pub mod clientbound_set_experience_packet; -pub mod clientbound_set_health_packet; -pub mod clientbound_set_held_slot_packet; -pub mod clientbound_set_objective_packet; -pub mod clientbound_set_passengers_packet; -pub mod clientbound_set_player_inventory_packet; -pub mod clientbound_set_player_team_packet; -pub mod clientbound_set_score_packet; -pub mod clientbound_set_simulation_distance_packet; -pub mod clientbound_set_subtitle_text_packet; -pub mod clientbound_set_time_packet; -pub mod clientbound_set_title_text_packet; -pub mod clientbound_set_titles_animation_packet; -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; -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_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; -pub mod serverbound_client_command_packet; -pub mod serverbound_client_information_packet; -pub mod serverbound_client_tick_end_packet; -pub mod serverbound_command_suggestion_packet; -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_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_packet; -pub mod serverbound_interact_packet; -pub mod serverbound_jigsaw_generate_packet; -pub mod serverbound_keep_alive_packet; -pub mod serverbound_lock_difficulty_packet; -pub mod serverbound_move_player_pos_packet; -pub mod serverbound_move_player_pos_rot_packet; -pub mod serverbound_move_player_rot_packet; -pub mod serverbound_move_player_status_only_packet; -pub mod serverbound_move_vehicle_packet; -pub mod serverbound_paddle_boat_packet; -pub mod serverbound_pick_item_packet; -pub mod serverbound_ping_request_packet; -pub mod serverbound_place_recipe_packet; -pub mod serverbound_player_abilities_packet; -pub mod serverbound_player_action_packet; -pub mod serverbound_player_command_packet; -pub mod serverbound_player_input_packet; -pub mod serverbound_pong_packet; -pub mod serverbound_recipe_book_change_settings_packet; -pub mod serverbound_recipe_book_seen_recipe_packet; -pub mod serverbound_rename_item_packet; -pub mod serverbound_resource_pack_packet; -pub mod serverbound_seen_advancements_packet; -pub mod serverbound_select_bundle_item_packet; -pub mod serverbound_select_trade_packet; -pub mod serverbound_set_beacon_packet; -pub mod serverbound_set_carried_item_packet; -pub mod serverbound_set_command_block_packet; -pub mod serverbound_set_command_minecart_packet; -pub mod serverbound_set_creative_mode_slot_packet; -pub mod serverbound_set_jigsaw_block_packet; -pub mod serverbound_set_structure_block_packet; -pub mod serverbound_sign_update_packet; -pub mod serverbound_swing_packet; -pub mod serverbound_teleport_to_entity_packet; -pub mod serverbound_use_item_on_packet; -pub mod serverbound_use_item_packet; +// NOTE: This file is generated automatically by codegen/packet.py. +// Don't edit it directly! use azalea_protocol_macros::declare_state_packets; -// see GameProtocols.java in the decompiled vanilla source - -declare_state_packets!( - GamePacket, - Serverbound => { - 0x00: serverbound_accept_teleportation_packet::ServerboundAcceptTeleportationPacket, - 0x01: serverbound_block_entity_tag_query_packet::ServerboundBlockEntityTagQueryPacket, - 0x02: serverbound_select_bundle_item_packet::ServerboundSelectBundleItemPacket, - 0x03: serverbound_change_difficulty_packet::ServerboundChangeDifficultyPacket, - 0x04: serverbound_chat_ack_packet::ServerboundChatAckPacket, - 0x05: serverbound_chat_command_packet::ServerboundChatCommandPacket, - 0x06: serverbound_chat_command_signed_packet::ServerboundChatCommandSignedPacket, - 0x07: serverbound_chat_packet::ServerboundChatPacket, - 0x08: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket, - 0x09: serverbound_chunk_batch_received_packet::ServerboundChunkBatchReceivedPacket, - 0x0a: serverbound_client_command_packet::ServerboundClientCommandPacket, - 0x0b: serverbound_client_tick_end_packet::ServerboundTickEndPacket, - 0x0c: serverbound_client_information_packet::ServerboundClientInformationPacket, - 0x0d: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket, - 0x0e: serverbound_configuration_acknowledged_packet::ServerboundConfigurationAcknowledgedPacket, - 0x0f: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket, - 0x10: serverbound_container_click_packet::ServerboundContainerClickPacket, - 0x11: serverbound_container_close_packet::ServerboundContainerClosePacket, - 0x12: serverbound_container_slot_state_changed_packet::ServerboundContainerSlotStateChangedPacket, - 0x13: serverbound_cookie_response_packet::ServerboundCookieResponsePacket, - 0x14: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, - 0x15: serverbound_debug_sample_subscription::ServerboundDebugSampleSubscription, - 0x16: serverbound_edit_book_packet::ServerboundEditBookPacket, - 0x17: serverbound_entity_tag_query_packet::ServerboundEntityTagQueryPacket, - 0x18: serverbound_interact_packet::ServerboundInteractPacket, - 0x19: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket, - 0x1a: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, - 0x1b: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket, - 0x1c: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, - 0x1d: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket, - 0x1e: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, - 0x1f: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, - 0x20: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket, - 0x21: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket, - 0x22: serverbound_pick_item_packet::ServerboundPickItemPacket, - 0x23: serverbound_ping_request_packet::ServerboundPingRequestPacket, - 0x24: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket, - 0x25: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket, - 0x26: serverbound_player_action_packet::ServerboundPlayerActionPacket, - 0x27: serverbound_player_command_packet::ServerboundPlayerCommandPacket, - 0x28: serverbound_player_input_packet::ServerboundPlayerInputPacket, - 0x29: serverbound_pong_packet::ServerboundPongPacket, - 0x2a: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket, - 0x2b: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket, - 0x2c: serverbound_rename_item_packet::ServerboundRenameItemPacket, - 0x2d: serverbound_resource_pack_packet::ServerboundResourcePackPacket, - 0x2e: serverbound_seen_advancements_packet::ServerboundSeenAdvancementsPacket, - 0x2f: serverbound_select_trade_packet::ServerboundSelectTradePacket, - 0x30: serverbound_set_beacon_packet::ServerboundSetBeaconPacket, - 0x31: serverbound_set_carried_item_packet::ServerboundSetCarriedItemPacket, - 0x32: serverbound_set_command_block_packet::ServerboundSetCommandBlockPacket, - 0x33: serverbound_set_command_minecart_packet::ServerboundSetCommandMinecartPacket, - 0x34: serverbound_set_creative_mode_slot_packet::ServerboundSetCreativeModeSlotPacket, - 0x35: serverbound_set_jigsaw_block_packet::ServerboundSetJigsawBlockPacket, - 0x36: serverbound_set_structure_block_packet::ServerboundSetStructureBlockPacket, - 0x37: serverbound_sign_update_packet::ServerboundSignUpdatePacket, - 0x38: serverbound_swing_packet::ServerboundSwingPacket, - 0x39: serverbound_teleport_to_entity_packet::ServerboundTeleportToEntityPacket, - 0x3a: serverbound_use_item_on_packet::ServerboundUseItemOnPacket, - 0x3b: serverbound_use_item_packet::ServerboundUseItemPacket, - }, - Clientbound => { - 0x00: clientbound_bundle_packet::ClientboundBundlePacket, - 0x01: clientbound_add_entity_packet::ClientboundAddEntityPacket, - 0x02: clientbound_add_experience_orb_packet::ClientboundAddExperienceOrbPacket, - 0x03: clientbound_animate_packet::ClientboundAnimatePacket, - 0x04: clientbound_award_stats_packet::ClientboundAwardStatsPacket, - 0x05: clientbound_block_changed_ack_packet::ClientboundBlockChangedAckPacket, - 0x06: clientbound_block_destruction_packet::ClientboundBlockDestructionPacket, - 0x07: clientbound_block_entity_data_packet::ClientboundBlockEntityDataPacket, - 0x08: clientbound_block_event_packet::ClientboundBlockEventPacket, - 0x09: clientbound_block_update_packet::ClientboundBlockUpdatePacket, - 0x0a: clientbound_boss_event_packet::ClientboundBossEventPacket, - 0x0b: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket, - 0x0c: clientbound_chunk_batch_finished_packet::ClientboundChunkBatchFinishedPacket, - 0x0d: clientbound_chunk_batch_start_packet::ClientboundChunkBatchStartPacket, - 0x0e: clientbound_chunks_biomes_packet::ClientboundChunksBiomesPacket, - 0x0f: clientbound_clear_titles_packet::ClientboundClearTitlesPacket, - 0x10: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket, - 0x11: clientbound_commands_packet::ClientboundCommandsPacket, - 0x12: clientbound_container_close_packet::ClientboundContainerClosePacket, - 0x13: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket, - 0x14: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket, - 0x15: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket, - 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_entity_position_sync_packet::ClientboundEntityPositionSyncPacket, - 0x21: clientbound_explode_packet::ClientboundExplodePacket, - 0x22: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket, - 0x23: clientbound_game_event_packet::ClientboundGameEventPacket, - 0x24: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket, - 0x25: clientbound_hurt_animation_packet::ClientboundHurtAnimationPacket, - 0x26: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket, - 0x27: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, - 0x28: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, - 0x29: clientbound_level_event_packet::ClientboundLevelEventPacket, - 0x2a: clientbound_level_particles_packet::ClientboundLevelParticlesPacket, - 0x2b: clientbound_light_update_packet::ClientboundLightUpdatePacket, - 0x2c: clientbound_login_packet::ClientboundLoginPacket, - 0x2d: clientbound_map_item_data_packet::ClientboundMapItemDataPacket, - 0x2e: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket, - 0x2f: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket, - 0x30: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket, - 0x31: clientbound_move_minecart_packet::ClientboundMoveMinecartPacket, - 0x32: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket, - 0x33: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket, - 0x34: clientbound_open_book_packet::ClientboundOpenBookPacket, - 0x35: clientbound_open_screen_packet::ClientboundOpenScreenPacket, - 0x36: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket, - 0x37: clientbound_ping_packet::ClientboundPingPacket, - 0x38: clientbound_pong_response_packet::ClientboundPongResponsePacket, - 0x39: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket, - 0x3a: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket, - 0x3b: clientbound_player_chat_packet::ClientboundPlayerChatPacket, - 0x3c: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket, - 0x3d: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket, - 0x3e: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket, - 0x3f: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket, - 0x40: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket, - 0x41: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket, - 0x42: clientbound_player_position_packet::ClientboundPlayerPositionPacket, - 0x43: clientbound_player_rotation_packet::ClientboundPlayerRotationPacket, - 0x44: clientbound_recipe_book_add_packet::ClientboundRecipeBookAddPacket, - 0x45: clientbound_recipe_book_remove_packet::ClientboundRecipeBookRemovePacket, - 0x46: clientbound_recipe_book_settings_packet::ClientboundRecipeBookSettingsPacket, - 0x47: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket, - 0x48: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket, - 0x49: clientbound_reset_score_packet::ClientboundResetScorePacket, - 0x4a: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket, - 0x4b: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket, - 0x4c: clientbound_respawn_packet::ClientboundRespawnPacket, - 0x4d: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, - 0x4e: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, - 0x4f: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket, - 0x50: clientbound_server_data_packet::ClientboundServerDataPacket, - 0x51: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket, - 0x52: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket, - 0x53: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket, - 0x54: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket, - 0x55: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket, - 0x56: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket, - 0x57: clientbound_set_camera_packet::ClientboundSetCameraPacket, - 0x58: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, - 0x59: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket, - 0x5a: clientbound_set_cursor_item_packet::ClientboundSetCursorItemPacket, - 0x5b: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, - 0x5c: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket, - 0x5d: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, - 0x5e: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, - 0x5f: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket, - 0x60: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, - 0x61: clientbound_set_experience_packet::ClientboundSetExperiencePacket, - 0x62: clientbound_set_health_packet::ClientboundSetHealthPacket, - 0x63: clientbound_set_held_slot_packet::ClientboundSetHeldSlotPacket, - 0x64: clientbound_set_objective_packet::ClientboundSetObjectivePacket, - 0x65: clientbound_set_passengers_packet::ClientboundSetPassengersPacket, - 0x66: clientbound_set_player_inventory_packet::ClientboundSetPlayerInventoryPacket, - 0x67: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket, - 0x68: clientbound_set_score_packet::ClientboundSetScorePacket, - 0x69: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket, - 0x6a: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket, - 0x6b: clientbound_set_time_packet::ClientboundSetTimePacket, - 0x6c: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket, - 0x6d: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket, - 0x6e: clientbound_sound_entity_packet::ClientboundSoundEntityPacket, - 0x6f: clientbound_sound_packet::ClientboundSoundPacket, - 0x70: clientbound_start_configuration_packet::ClientboundStartConfigurationPacket, - 0x71: clientbound_stop_sound_packet::ClientboundStopSoundPacket, - 0x72: clientbound_store_cookie_packet::ClientboundStoreCookiePacket, - 0x73: clientbound_system_chat_packet::ClientboundSystemChatPacket, - 0x74: clientbound_tab_list_packet::ClientboundTabListPacket, - 0x75: clientbound_tag_query_packet::ClientboundTagQueryPacket, - 0x76: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket, - 0x77: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, - 0x78: clientbound_ticking_state_packet::ClientboundTickingStatePacket, - 0x79: clientbound_ticking_step_packet::ClientboundTickingStepPacket, - 0x7a: clientbound_transfer_packet::ClientboundTransferPacket, - 0x7b: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, - 0x7c: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, - 0x7d: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, - 0x7e: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, - 0x7f: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, - 0x80: clientbound_projectile_power_packet::ClientboundProjectilePowerPacket, - 0x81: clientbound_custom_report_details_packet::ClientboundCustomReportDetailsPacket, - 0x82: clientbound_server_links_packet::ClientboundServerLinksPacket - } +declare_state_packets!(GamePacket, + Clientbound => [ + bundle_delimiter, + add_entity, + add_experience_orb, + animate, + award_stats, + block_changed_ack, + block_destruction, + block_entity_data, + block_event, + block_update, + boss_event, + change_difficulty, + chunk_batch_finished, + chunk_batch_start, + chunks_biomes, + clear_titles, + command_suggestions, + commands, + container_close, + container_set_content, + container_set_data, + container_set_slot, + cookie_request, + cooldown, + custom_chat_completions, + custom_payload, + damage_event, + debug_sample, + delete_chat, + disconnect, + disguised_chat, + entity_event, + entity_position_sync, + explode, + forget_level_chunk, + game_event, + horse_screen_open, + hurt_animation, + initialize_border, + keep_alive, + level_chunk_with_light, + level_event, + level_particles, + light_update, + login, + map_item_data, + merchant_offers, + move_entity_pos, + move_entity_pos_rot, + move_minecart_along_track, + move_entity_rot, + move_vehicle, + open_book, + open_screen, + open_sign_editor, + ping, + pong_response, + place_ghost_recipe, + player_abilities, + player_chat, + player_combat_end, + player_combat_enter, + player_combat_kill, + player_info_remove, + player_info_update, + player_look_at, + player_position, + player_rotation, + recipe_book_add, + recipe_book_remove, + recipe_book_settings, + remove_entities, + remove_mob_effect, + reset_score, + resource_pack_pop, + resource_pack_push, + respawn, + rotate_head, + section_blocks_update, + select_advancements_tab, + server_data, + set_action_bar_text, + set_border_center, + set_border_lerp_size, + set_border_size, + set_border_warning_delay, + set_border_warning_distance, + set_camera, + set_chunk_cache_center, + set_chunk_cache_radius, + set_cursor_item, + set_default_spawn_position, + set_display_objective, + set_entity_data, + set_entity_link, + set_entity_motion, + set_equipment, + set_experience, + set_health, + set_held_slot, + set_objective, + set_passengers, + set_player_inventory, + set_player_team, + set_score, + set_simulation_distance, + set_subtitle_text, + set_time, + set_title_text, + set_titles_animation, + sound_entity, + sound, + start_configuration, + stop_sound, + store_cookie, + system_chat, + tab_list, + tag_query, + take_item_entity, + teleport_entity, + ticking_state, + ticking_step, + transfer, + update_advancements, + update_attributes, + update_mob_effect, + update_recipes, + update_tags, + projectile_power, + custom_report_details, + server_links, + ], + Serverbound => [ + accept_teleportation, + block_entity_tag_query, + bundle_item_selected, + change_difficulty, + chat_ack, + chat_command, + chat_command_signed, + chat, + chat_session_update, + chunk_batch_received, + client_command, + client_tick_end, + client_information, + command_suggestion, + configuration_acknowledged, + container_button_click, + container_click, + container_close, + container_slot_state_changed, + cookie_response, + custom_payload, + debug_sample_subscription, + edit_book, + entity_tag_query, + interact, + jigsaw_generate, + keep_alive, + lock_difficulty, + move_player_pos, + move_player_pos_rot, + move_player_rot, + move_player_status_only, + move_vehicle, + paddle_boat, + pick_item, + ping_request, + place_recipe, + player_abilities, + player_action, + player_command, + player_input, + pong, + recipe_book_change_settings, + recipe_book_seen_recipe, + rename_item, + resource_pack, + seen_advancements, + select_trade, + set_beacon, + set_carried_item, + set_command_block, + set_command_minecart, + set_creative_mode_slot, + set_jigsaw_block, + set_structure_block, + sign_update, + swing, + teleport_to_entity, + use_item_on, + use_item, + ] ); diff --git a/azalea-protocol/src/packets/game/s_accept_teleportation.rs b/azalea-protocol/src/packets/game/s_accept_teleportation.rs new file mode 100755 index 00000000..dedc125a --- /dev/null +++ b/azalea-protocol/src/packets/game/s_accept_teleportation.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundAcceptTeleportation { + #[var] + pub id: u32, +} diff --git a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query.rs b/azalea-protocol/src/packets/game/s_block_entity_tag_query.rs index 4b396a67..159f12dc 100755..100644 --- a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query.rs +++ b/azalea-protocol/src/packets/game/s_block_entity_tag_query.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] pub struct ServerboundBlockEntityTagQuery { #[var] - pub transaction_id: i32, + pub transaction_id: u32, pub pos: BlockPos, } diff --git a/azalea-protocol/src/packets/game/serverbound_select_bundle_item_packet.rs b/azalea-protocol/src/packets/game/s_bundle_item_selected.rs index 3a315183..552e51f8 100644 --- a/azalea-protocol/src/packets/game/serverbound_select_bundle_item_packet.rs +++ b/azalea-protocol/src/packets/game/s_bundle_item_selected.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSelectBundleItemPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundBundleItemSelected { #[var] pub slot_id: i32, #[var] diff --git a/azalea-protocol/src/packets/game/serverbound_change_difficulty_packet.rs b/azalea-protocol/src/packets/game/s_change_difficulty.rs index 460de5b2..7dcd3c83 100755 --- a/azalea-protocol/src/packets/game/serverbound_change_difficulty_packet.rs +++ b/azalea-protocol/src/packets/game/s_change_difficulty.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::difficulty::Difficulty; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChangeDifficultyPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChangeDifficulty { pub difficulty: Difficulty, } diff --git a/azalea-protocol/src/packets/game/serverbound_chat_packet.rs b/azalea-protocol/src/packets/game/s_chat.rs index e0a1726c..03bafd11 100755 --- a/azalea-protocol/src/packets/game/serverbound_chat_packet.rs +++ b/azalea-protocol/src/packets/game/s_chat.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::bitset::FixedBitSet; use azalea_crypto::MessageSignature; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChat { pub message: String, pub timestamp: u64, pub salt: u64, @@ -12,7 +12,7 @@ pub struct ServerboundChatPacket { pub last_seen_messages: LastSeenMessagesUpdate, } -#[derive(Clone, Debug, McBuf, Default)] +#[derive(Clone, Debug, AzBuf, Default)] pub struct LastSeenMessagesUpdate { #[var] pub messages: u32, diff --git a/azalea-protocol/src/packets/game/s_chat_ack.rs b/azalea-protocol/src/packets/game/s_chat_ack.rs new file mode 100755 index 00000000..d4b6efd6 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_ack.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatAck { + #[var] + pub messages: u32, +} diff --git a/azalea-protocol/src/packets/game/s_chat_command.rs b/azalea-protocol/src/packets/game/s_chat_command.rs new file mode 100755 index 00000000..4fdab9f9 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_command.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatCommand { + pub command: String, +} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs b/azalea-protocol/src/packets/game/s_chat_command_signed.rs index f64b79cc..c20f3c6d 100755 --- a/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs +++ b/azalea-protocol/src/packets/game/s_chat_command_signed.rs @@ -1,11 +1,11 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_crypto::MessageSignature; use azalea_protocol_macros::ServerboundGamePacket; -use super::serverbound_chat_packet::LastSeenMessagesUpdate; +use super::s_chat::LastSeenMessagesUpdate; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatCommandSignedPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatCommandSigned { pub command: String, pub timestamp: u64, pub salt: u64, @@ -13,7 +13,7 @@ pub struct ServerboundChatCommandSignedPacket { pub last_seen_messages: LastSeenMessagesUpdate, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct ArgumentSignature { pub name: String, pub signature: MessageSignature, diff --git a/azalea-protocol/src/packets/game/s_chat_preview.rs b/azalea-protocol/src/packets/game/s_chat_preview.rs new file mode 100755 index 00000000..3d2bf34e --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_preview.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatPreview { + pub query_id: i32, + pub query: String, +} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_session_update_packet.rs b/azalea-protocol/src/packets/game/s_chat_session_update.rs index e56d2bc6..f3499983 100644 --- a/azalea-protocol/src/packets/game/serverbound_chat_session_update_packet.rs +++ b/azalea-protocol/src/packets/game/s_chat_session_update.rs @@ -1,19 +1,19 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; use uuid::Uuid; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatSessionUpdatePacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatSessionUpdate { pub chat_session: RemoteChatSessionData, } -#[derive(Clone, Debug, PartialEq, Eq, McBuf)] +#[derive(Clone, Debug, PartialEq, Eq, AzBuf)] pub struct RemoteChatSessionData { pub session_id: Uuid, pub profile_public_key: ProfilePublicKeyData, } -#[derive(Clone, Debug, McBuf, PartialEq, Eq)] +#[derive(Clone, Debug, AzBuf, PartialEq, Eq)] pub struct ProfilePublicKeyData { pub expires_at: u64, pub key: Vec<u8>, diff --git a/azalea-protocol/src/packets/game/s_chunk_batch_received.rs b/azalea-protocol/src/packets/game/s_chunk_batch_received.rs new file mode 100644 index 00000000..faa50932 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chunk_batch_received.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChunkBatchReceived { + pub desired_chunks_per_tick: f32, +} diff --git a/azalea-protocol/src/packets/game/s_client_command.rs b/azalea-protocol/src/packets/game/s_client_command.rs new file mode 100755 index 00000000..5742bdb4 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_client_command.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundClientCommand { + pub action: Action, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Action { + PerformRespawn = 0, + RequestStats = 1, +} diff --git a/azalea-protocol/src/packets/game/s_client_information.rs b/azalea-protocol/src/packets/game/s_client_information.rs new file mode 100755 index 00000000..5861212c --- /dev/null +++ b/azalea-protocol/src/packets/game/s_client_information.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::common::client_information::ClientInformation; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundClientInformation { + pub information: ClientInformation, +} diff --git a/azalea-protocol/src/packets/game/s_client_tick_end.rs b/azalea-protocol/src/packets/game/s_client_tick_end.rs new file mode 100644 index 00000000..d8d93049 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_client_tick_end.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundClientTickEnd {} diff --git a/azalea-protocol/src/packets/game/s_command_suggestion.rs b/azalea-protocol/src/packets/game/s_command_suggestion.rs new file mode 100755 index 00000000..2e52a969 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_command_suggestion.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundCommandSuggestion { + #[var] + pub id: u32, + pub command: String, +} diff --git a/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs b/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs new file mode 100644 index 00000000..58e27abb --- /dev/null +++ b/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundConfigurationAcknowledged {} diff --git a/azalea-protocol/src/packets/game/s_container_button_click.rs b/azalea-protocol/src/packets/game/s_container_button_click.rs new file mode 100755 index 00000000..909772f3 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_container_button_click.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerButtonClick { + pub container_id: u8, + pub button_id: u8, +} diff --git a/azalea-protocol/src/packets/game/s_container_click.rs b/azalea-protocol/src/packets/game/s_container_click.rs new file mode 100755 index 00000000..a6dee697 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_container_click.rs @@ -0,0 +1,17 @@ +use std::collections::HashMap; + +use azalea_buf::AzBuf; +use azalea_inventory::{operations::ClickType, ItemStack}; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerClick { + pub container_id: u8, + #[var] + pub state_id: u32, + pub slot_num: i16, + pub button_num: u8, + pub click_type: ClickType, + pub changed_slots: HashMap<u16, ItemStack>, + pub carried_item: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/s_container_close.rs b/azalea-protocol/src/packets/game/s_container_close.rs new file mode 100755 index 00000000..1cb88eab --- /dev/null +++ b/azalea-protocol/src/packets/game/s_container_close.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerClose { + pub container_id: u8, +} diff --git a/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs b/azalea-protocol/src/packets/game/s_container_slot_state_changed.rs index 8a83f4e2..73ac0280 100644 --- a/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs +++ b/azalea-protocol/src/packets/game/s_container_slot_state_changed.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerSlotStateChangedPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerSlotStateChanged { #[var] pub slot_id: u32, #[var] diff --git a/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs b/azalea-protocol/src/packets/game/s_cookie_response.rs index 8ad0f07e..5159d72e 100644 --- a/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs +++ b/azalea-protocol/src/packets/game/s_cookie_response.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundCookieResponsePacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundCookieResponse { pub key: ResourceLocation, pub payload: Option<Vec<u8>>, } diff --git a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/s_custom_payload.rs index d5d46627..b32f1d24 100755 --- a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs +++ b/azalea-protocol/src/packets/game/s_custom_payload.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_buf::UnsizedByteArray; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundCustomPayloadPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundCustomPayload { pub identifier: ResourceLocation, pub data: UnsizedByteArray, } diff --git a/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs b/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs index 236972e0..45051793 100755..100644 --- a/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs +++ b/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs @@ -1,12 +1,12 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] pub struct ServerboundDebugSampleSubscription { pub sample_type: RemoteDebugSampleType, } -#[derive(Clone, Copy, Debug, McBuf)] +#[derive(Clone, Copy, Debug, AzBuf)] pub enum RemoteDebugSampleType { TickTime, } diff --git a/azalea-protocol/src/packets/game/serverbound_edit_book_packet.rs b/azalea-protocol/src/packets/game/s_edit_book.rs index 62d4b318..af05a7cd 100755 --- a/azalea-protocol/src/packets/game/serverbound_edit_book_packet.rs +++ b/azalea-protocol/src/packets/game/s_edit_book.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundEditBookPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundEditBook { #[var] pub slot: u32, pub pages: Vec<String>, diff --git a/azalea-protocol/src/packets/game/serverbound_entity_tag_query.rs b/azalea-protocol/src/packets/game/s_entity_tag_query.rs index 5b0c7db6..619e9e54 100755..100644 --- a/azalea-protocol/src/packets/game/serverbound_entity_tag_query.rs +++ b/azalea-protocol/src/packets/game/s_entity_tag_query.rs @@ -1,7 +1,7 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] pub struct ServerboundEntityTagQuery { #[var] pub transaction_id: u32, diff --git a/azalea-protocol/src/packets/game/serverbound_interact_packet.rs b/azalea-protocol/src/packets/game/s_interact.rs index e393920c..cdd9cba5 100755 --- a/azalea-protocol/src/packets/game/serverbound_interact_packet.rs +++ b/azalea-protocol/src/packets/game/s_interact.rs @@ -1,13 +1,13 @@ use std::io::{Cursor, Write}; -use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar}; use azalea_core::position::Vec3; use azalea_protocol_macros::ServerboundGamePacket; use crate::packets::BufReadError; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundInteractPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundInteract { #[var] pub entity_id: u32, pub action: ActionType, @@ -27,42 +27,42 @@ pub enum ActionType { }, } -impl McBufWritable for ActionType { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for ActionType { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { match self { ActionType::Interact { hand } => { - 0u32.var_write_into(buf)?; - hand.write_into(buf)?; + 0u32.azalea_write_var(buf)?; + hand.azalea_write(buf)?; } ActionType::Attack => { - 1u32.var_write_into(buf)?; + 1u32.azalea_write_var(buf)?; } ActionType::InteractAt { location, hand } => { - 2u32.var_write_into(buf)?; - (location.x as f32).write_into(buf)?; - (location.y as f32).write_into(buf)?; - (location.z as f32).write_into(buf)?; - hand.write_into(buf)?; + 2u32.azalea_write_var(buf)?; + (location.x as f32).azalea_write(buf)?; + (location.y as f32).azalea_write(buf)?; + (location.z as f32).azalea_write(buf)?; + hand.azalea_write(buf)?; } } Ok(()) } } -impl McBufReadable for ActionType { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let action_type = u32::var_read_from(buf)?; +impl AzaleaRead for ActionType { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let action_type = u32::azalea_read_var(buf)?; match action_type { 0 => { - let hand = InteractionHand::read_from(buf)?; + let hand = InteractionHand::azalea_read(buf)?; Ok(ActionType::Interact { hand }) } 1 => Ok(ActionType::Attack), 2 => { - let x = f32::read_from(buf)?; - let y = f32::read_from(buf)?; - let z = f32::read_from(buf)?; - let hand = InteractionHand::read_from(buf)?; + let x = f32::azalea_read(buf)?; + let y = f32::azalea_read(buf)?; + let z = f32::azalea_read(buf)?; + let hand = InteractionHand::azalea_read(buf)?; Ok(ActionType::InteractAt { location: Vec3 { x: f64::from(x), @@ -79,7 +79,7 @@ impl McBufReadable for ActionType { } } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum InteractionHand { MainHand = 0, OffHand = 1, diff --git a/azalea-protocol/src/packets/game/serverbound_jigsaw_generate_packet.rs b/azalea-protocol/src/packets/game/s_jigsaw_generate.rs index 34fd5985..4a3b58ce 100755 --- a/azalea-protocol/src/packets/game/serverbound_jigsaw_generate_packet.rs +++ b/azalea-protocol/src/packets/game/s_jigsaw_generate.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundJigsawGeneratePacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundJigsawGenerate { pub pos: BlockPos, #[var] pub levels: u32, diff --git a/azalea-protocol/src/packets/game/s_keep_alive.rs b/azalea-protocol/src/packets/game/s_keep_alive.rs new file mode 100755 index 00000000..a6806a92 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_keep_alive.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundKeepAlive { + pub id: u64, +} diff --git a/azalea-protocol/src/packets/game/s_lock_difficulty.rs b/azalea-protocol/src/packets/game/s_lock_difficulty.rs new file mode 100755 index 00000000..72acb705 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_lock_difficulty.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundLockDifficulty { + pub locked: bool, +} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_pos_packet.rs b/azalea-protocol/src/packets/game/s_move_player_pos.rs index 4e3face4..2e2ec0c5 100755 --- a/azalea-protocol/src/packets/game/serverbound_move_player_pos_packet.rs +++ b/azalea-protocol/src/packets/game/s_move_player_pos.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerPosPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerPos { pub x: f64, pub y: f64, pub z: f64, diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_pos_rot_packet.rs b/azalea-protocol/src/packets/game/s_move_player_pos_rot.rs index 0ab9c885..cb0e0633 100755 --- a/azalea-protocol/src/packets/game/serverbound_move_player_pos_rot_packet.rs +++ b/azalea-protocol/src/packets/game/s_move_player_pos_rot.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerPosRotPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerPosRot { pub x: f64, pub y: f64, pub z: f64, diff --git a/azalea-protocol/src/packets/game/s_move_player_rot.rs b/azalea-protocol/src/packets/game/s_move_player_rot.rs new file mode 100755 index 00000000..c3cda3ea --- /dev/null +++ b/azalea-protocol/src/packets/game/s_move_player_rot.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerRot { + pub y_rot: f32, + pub x_rot: f32, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/s_move_player_status_only.rs b/azalea-protocol/src/packets/game/s_move_player_status_only.rs new file mode 100755 index 00000000..155841f0 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_move_player_status_only.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerStatusOnly { + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/serverbound_move_vehicle_packet.rs b/azalea-protocol/src/packets/game/s_move_vehicle.rs index 929ba798..0452c9b0 100755 --- a/azalea-protocol/src/packets/game/serverbound_move_vehicle_packet.rs +++ b/azalea-protocol/src/packets/game/s_move_vehicle.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMoveVehiclePacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMoveVehicle { pub x: f64, pub y: f64, pub z: f64, diff --git a/azalea-protocol/src/packets/game/s_paddle_boat.rs b/azalea-protocol/src/packets/game/s_paddle_boat.rs new file mode 100755 index 00000000..eed7addc --- /dev/null +++ b/azalea-protocol/src/packets/game/s_paddle_boat.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPaddleBoat { + pub left: bool, + pub right: bool, +} diff --git a/azalea-protocol/src/packets/game/s_pick_item.rs b/azalea-protocol/src/packets/game/s_pick_item.rs new file mode 100755 index 00000000..289da6e7 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_pick_item.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPickItem { + #[var] + pub slot: u32, +} diff --git a/azalea-protocol/src/packets/game/s_pick_item_from_entity.rs b/azalea-protocol/src/packets/game/s_pick_item_from_entity.rs new file mode 100644 index 00000000..42032063 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_pick_item_from_entity.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPickItemFromEntity { + #[var] + pub id: u32, + pub include_data: bool, +} diff --git a/azalea-protocol/src/packets/game/s_ping_request.rs b/azalea-protocol/src/packets/game/s_ping_request.rs new file mode 100755 index 00000000..1ea7550f --- /dev/null +++ b/azalea-protocol/src/packets/game/s_ping_request.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPingRequest { + pub time: u64, +} diff --git a/azalea-protocol/src/packets/game/serverbound_place_recipe_packet.rs b/azalea-protocol/src/packets/game/s_place_recipe.rs index 03dd833b..33456948 100755 --- a/azalea-protocol/src/packets/game/serverbound_place_recipe_packet.rs +++ b/azalea-protocol/src/packets/game/s_place_recipe.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPlaceRecipePacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlaceRecipe { pub container_id: u8, pub recipe: ResourceLocation, pub shift_down: bool, diff --git a/azalea-protocol/src/packets/game/s_player_abilities.rs b/azalea-protocol/src/packets/game/s_player_abilities.rs new file mode 100755 index 00000000..fdf2d8a4 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_player_abilities.rs @@ -0,0 +1,31 @@ +use std::io::Cursor; + +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::bitset::FixedBitSet; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::BufReadError; + +#[derive(Clone, Debug, ServerboundGamePacket)] +pub struct ServerboundPlayerAbilities { + pub is_flying: bool, +} + +impl AzaleaRead for ServerboundPlayerAbilities { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let set = FixedBitSet::<2>::azalea_read(buf)?; + Ok(Self { + is_flying: set.index(1), + }) + } +} + +impl AzaleaWrite for ServerboundPlayerAbilities { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<2>::new(); + if self.is_flying { + set.set(1); + } + set.azalea_write(buf) + } +} diff --git a/azalea-protocol/src/packets/game/serverbound_player_action_packet.rs b/azalea-protocol/src/packets/game/s_player_action.rs index 6719202f..5b65b746 100755 --- a/azalea-protocol/src/packets/game/serverbound_player_action_packet.rs +++ b/azalea-protocol/src/packets/game/s_player_action.rs @@ -1,10 +1,10 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::direction::Direction; use azalea_core::position::BlockPos; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPlayerActionPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlayerAction { pub action: Action, pub pos: BlockPos, pub direction: Direction, @@ -12,7 +12,7 @@ pub struct ServerboundPlayerActionPacket { pub sequence: u32, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Action { StartDestroyBlock = 0, AbortDestroyBlock = 1, diff --git a/azalea-protocol/src/packets/game/serverbound_player_command_packet.rs b/azalea-protocol/src/packets/game/s_player_command.rs index d7688092..72a92310 100755 --- a/azalea-protocol/src/packets/game/serverbound_player_command_packet.rs +++ b/azalea-protocol/src/packets/game/s_player_command.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPlayerCommandPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlayerCommand { #[var] pub id: u32, pub action: Action, @@ -10,7 +10,7 @@ pub struct ServerboundPlayerCommandPacket { pub data: u32, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Action { PressShiftKey = 0, ReleaseShiftKey = 1, diff --git a/azalea-protocol/src/packets/game/serverbound_player_input_packet.rs b/azalea-protocol/src/packets/game/s_player_input.rs index a461ddf5..bd4ba970 100755 --- a/azalea-protocol/src/packets/game/serverbound_player_input_packet.rs +++ b/azalea-protocol/src/packets/game/s_player_input.rs @@ -1,12 +1,12 @@ use std::io::Cursor; use azalea_buf::BufReadError; -use azalea_buf::{McBufReadable, McBufWritable}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; use azalea_core::bitset::FixedBitSet; use azalea_protocol_macros::ServerboundGamePacket; #[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundPlayerInputPacket { +pub struct ServerboundPlayerInput { pub forward: bool, pub backward: bool, pub left: bool, @@ -16,9 +16,9 @@ pub struct ServerboundPlayerInputPacket { pub sprint: bool, } -impl McBufReadable for ServerboundPlayerInputPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let set = FixedBitSet::<7>::read_from(buf)?; +impl AzaleaRead for ServerboundPlayerInput { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let set = FixedBitSet::<7>::azalea_read(buf)?; Ok(Self { forward: set.index(0), backward: set.index(1), @@ -31,8 +31,8 @@ impl McBufReadable for ServerboundPlayerInputPacket { } } -impl McBufWritable for ServerboundPlayerInputPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for ServerboundPlayerInput { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<7>::new(); if self.forward { set.set(0); @@ -55,6 +55,6 @@ impl McBufWritable for ServerboundPlayerInputPacket { if self.sprint { set.set(6); } - set.write_into(buf) + set.azalea_write(buf) } } diff --git a/azalea-protocol/src/packets/game/s_player_loaded.rs b/azalea-protocol/src/packets/game/s_player_loaded.rs new file mode 100644 index 00000000..3e809b26 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_player_loaded.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlayerLoaded; diff --git a/azalea-protocol/src/packets/game/s_pong.rs b/azalea-protocol/src/packets/game/s_pong.rs new file mode 100755 index 00000000..10ce0fb7 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_pong.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPong { + pub id: u32, +} diff --git a/azalea-protocol/src/packets/game/serverbound_recipe_book_change_settings_packet.rs b/azalea-protocol/src/packets/game/s_recipe_book_change_settings.rs index 6b3f015b..a31ca173 100755 --- a/azalea-protocol/src/packets/game/serverbound_recipe_book_change_settings_packet.rs +++ b/azalea-protocol/src/packets/game/s_recipe_book_change_settings.rs @@ -1,14 +1,14 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundRecipeBookChangeSettingsPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundRecipeBookChangeSettings { pub book_type: RecipeBookType, pub is_open: bool, pub is_filtering: bool, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum RecipeBookType { Crafting = 0, Furnace = 1, diff --git a/azalea-protocol/src/packets/game/serverbound_recipe_book_seen_recipe_packet.rs b/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs index 9923e3a6..9eeffde9 100755 --- a/azalea-protocol/src/packets/game/serverbound_recipe_book_seen_recipe_packet.rs +++ b/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundRecipeBookSeenRecipePacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundRecipeBookSeenRecipe { pub recipe: ResourceLocation, } diff --git a/azalea-protocol/src/packets/game/s_rename_item.rs b/azalea-protocol/src/packets/game/s_rename_item.rs new file mode 100755 index 00000000..4c913ba0 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_rename_item.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundRenameItem { + pub name: String, +} diff --git a/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs b/azalea-protocol/src/packets/game/s_resource_pack.rs index f285707b..7bdb7bb4 100755 --- a/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs +++ b/azalea-protocol/src/packets/game/s_resource_pack.rs @@ -1,14 +1,14 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; use uuid::Uuid; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundResourcePackPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundResourcePack { pub id: Uuid, pub action: Action, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Action { SuccessfullyLoaded = 0, Declined = 1, diff --git a/azalea-protocol/src/packets/game/s_seen_advancements.rs b/azalea-protocol/src/packets/game/s_seen_advancements.rs new file mode 100755 index 00000000..f46411f0 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_seen_advancements.rs @@ -0,0 +1,41 @@ +use std::io::Cursor; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::BufReadError; + +#[derive(Clone, Debug, ServerboundGamePacket)] +pub struct ServerboundSeenAdvancements { + pub action: Action, + pub tab: Option<ResourceLocation>, +} + +#[derive(AzBuf, Clone, Copy, Debug, Eq, PartialEq)] +pub enum Action { + OpenedTab = 0, + ClosedScreen = 1, +} + +impl AzaleaRead for ServerboundSeenAdvancements { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let action = Action::azalea_read(buf)?; + let tab = if action == Action::OpenedTab { + Some(ResourceLocation::azalea_read(buf)?) + } else { + None + }; + Ok(Self { action, tab }) + } +} + +impl AzaleaWrite for ServerboundSeenAdvancements { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + self.action.azalea_write(buf)?; + if let Some(tab) = &self.tab { + tab.azalea_write(buf)?; + } + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/s_select_trade.rs b/azalea-protocol/src/packets/game/s_select_trade.rs new file mode 100755 index 00000000..e0cc8aab --- /dev/null +++ b/azalea-protocol/src/packets/game/s_select_trade.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSelectTrade { + #[var] + pub item: u32, +} diff --git a/azalea-protocol/src/packets/game/serverbound_set_beacon_packet.rs b/azalea-protocol/src/packets/game/s_set_beacon.rs index db76cb9c..b0b911a1 100755 --- a/azalea-protocol/src/packets/game/serverbound_set_beacon_packet.rs +++ b/azalea-protocol/src/packets/game/s_set_beacon.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetBeaconPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetBeacon { #[var] pub primary: Option<u32>, #[var] diff --git a/azalea-protocol/src/packets/game/s_set_carried_item.rs b/azalea-protocol/src/packets/game/s_set_carried_item.rs new file mode 100755 index 00000000..5efa2d44 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_carried_item.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetCarriedItem { + pub slot: u16, +} diff --git a/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs b/azalea-protocol/src/packets/game/s_set_command_block.rs index db6557fd..dacb79de 100755 --- a/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs +++ b/azalea-protocol/src/packets/game/s_set_command_block.rs @@ -1,13 +1,13 @@ use std::io::Cursor; -use azalea_buf::{BufReadError, McBuf, McBufReadable}; +use azalea_buf::{AzBuf, AzaleaRead, BufReadError}; use azalea_core::{bitset::FixedBitSet, position::BlockPos}; use azalea_protocol_macros::ServerboundGamePacket; -use crate::packets::McBufWritable; +use crate::packets::AzaleaWrite; #[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundSetCommandBlockPacket { +pub struct ServerboundSetCommandBlock { pub pos: BlockPos, pub command: String, pub mode: Mode, @@ -17,20 +17,20 @@ pub struct ServerboundSetCommandBlockPacket { pub automatic: bool, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Mode { Sequence = 0, Auto = 1, Redstone = 2, } -impl McBufReadable for ServerboundSetCommandBlockPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let pos = BlockPos::read_from(buf)?; - let command = String::read_from(buf)?; - let mode = Mode::read_from(buf)?; +impl AzaleaRead for ServerboundSetCommandBlock { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let pos = BlockPos::azalea_read(buf)?; + let command = String::azalea_read(buf)?; + let mode = Mode::azalea_read(buf)?; - let set = FixedBitSet::<3>::read_from(buf)?; + let set = FixedBitSet::<3>::azalea_read(buf)?; Ok(Self { pos, command, @@ -42,11 +42,11 @@ impl McBufReadable for ServerboundSetCommandBlockPacket { } } -impl McBufWritable for ServerboundSetCommandBlockPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - self.pos.write_into(buf)?; - self.command.write_into(buf)?; - self.mode.write_into(buf)?; +impl AzaleaWrite for ServerboundSetCommandBlock { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + self.pos.azalea_write(buf)?; + self.command.azalea_write(buf)?; + self.mode.azalea_write(buf)?; let mut set = FixedBitSet::<3>::new(); if self.track_output { @@ -58,6 +58,6 @@ impl McBufWritable for ServerboundSetCommandBlockPacket { if self.automatic { set.set(2); } - set.write_into(buf) + set.azalea_write(buf) } } diff --git a/azalea-protocol/src/packets/game/serverbound_set_command_minecart_packet.rs b/azalea-protocol/src/packets/game/s_set_command_minecart.rs index 7756c924..0431a865 100755 --- a/azalea-protocol/src/packets/game/serverbound_set_command_minecart_packet.rs +++ b/azalea-protocol/src/packets/game/s_set_command_minecart.rs @@ -1,8 +1,8 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetCommandMinecartPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetCommandMinecart { #[var] pub entity: u32, pub command: String, diff --git a/azalea-protocol/src/packets/game/s_set_creative_mode_slot.rs b/azalea-protocol/src/packets/game/s_set_creative_mode_slot.rs new file mode 100755 index 00000000..e4b26a64 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_creative_mode_slot.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetCreativeModeSlot { + pub slot_num: u16, + pub item_stack: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs index 33a82311..1d97d4c7 100755 --- a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs +++ b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs @@ -1,17 +1,17 @@ use std::io::Cursor; use std::io::Write; -use azalea_buf::McBuf; -use azalea_buf::McBufReadable; +use azalea_buf::AzBuf; +use azalea_buf::AzaleaRead; use azalea_core::position::BlockPos; use azalea_core::resource_location::ResourceLocation; use azalea_protocol_macros::ServerboundGamePacket; +use crate::packets::AzaleaWrite; use crate::packets::BufReadError; -use crate::packets::McBufWritable; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetJigsawBlockPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetJigsawBlock { pub pos: BlockPos, pub name: ResourceLocation, pub target: ResourceLocation, @@ -29,9 +29,9 @@ pub enum JointType { Aligned, } -impl McBufReadable for JointType { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let name = String::read_from(buf)?; +impl AzaleaRead for JointType { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let name = String::azalea_read(buf)?; match name.as_str() { "rollable" => Ok(JointType::Rollable), "aligned" => Ok(JointType::Aligned), @@ -40,11 +40,11 @@ impl McBufReadable for JointType { } } -impl McBufWritable for JointType { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for JointType { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { match self { - JointType::Rollable => "rollable".to_string().write_into(buf)?, - JointType::Aligned => "aligned".to_string().write_into(buf)?, + JointType::Rollable => "rollable".to_string().azalea_write(buf)?, + JointType::Aligned => "aligned".to_string().azalea_write(buf)?, }; Ok(()) } diff --git a/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs b/azalea-protocol/src/packets/game/s_set_structure_block.rs index c2872812..7f05a3a7 100755 --- a/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs +++ b/azalea-protocol/src/packets/game/s_set_structure_block.rs @@ -1,14 +1,14 @@ use std::io::{Cursor, Write}; -use azalea_buf::McBuf; -use azalea_buf::{McBufReadable, McBufWritable}; +use azalea_buf::AzBuf; +use azalea_buf::{AzaleaRead, AzaleaWrite}; use azalea_core::{bitset::FixedBitSet, position::BlockPos}; use azalea_protocol_macros::ServerboundGamePacket; use crate::packets::BufReadError; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetStructureBlockPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetStructureBlock { pub pos: BlockPos, pub update_type: UpdateType, pub mode: StructureMode, @@ -24,14 +24,14 @@ pub struct ServerboundSetStructureBlockPacket { pub flags: Flags, } -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct BytePosition { pub x: u8, pub y: u8, pub z: u8, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum UpdateType { UpdateData = 0, SaveArea = 1, @@ -39,7 +39,7 @@ pub enum UpdateType { ScanArea = 3, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum StructureMode { Save = 0, Load = 1, @@ -47,14 +47,14 @@ pub enum StructureMode { Data = 3, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Mirror { None = 0, LeftRight = 1, FrontBack = 2, } -#[derive(McBuf, Clone, Copy, Debug)] +#[derive(AzBuf, Clone, Copy, Debug)] pub enum Rotation { None = 0, Clockwise90 = 1, @@ -69,9 +69,9 @@ pub struct Flags { pub show_bounding_box: bool, } -impl McBufReadable for Flags { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let set = FixedBitSet::<3>::read_from(buf)?; +impl AzaleaRead for Flags { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let set = FixedBitSet::<3>::azalea_read(buf)?; Ok(Self { ignore_entities: set.index(0), show_air: set.index(1), @@ -80,8 +80,8 @@ impl McBufReadable for Flags { } } -impl McBufWritable for Flags { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { +impl AzaleaWrite for Flags { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut set = FixedBitSet::<3>::new(); if self.ignore_entities { set.set(0); @@ -92,7 +92,7 @@ impl McBufWritable for Flags { if self.show_bounding_box { set.set(2); } - set.write_into(buf)?; + set.azalea_write(buf)?; Ok(()) } } diff --git a/azalea-protocol/src/packets/game/serverbound_sign_update_packet.rs b/azalea-protocol/src/packets/game/s_sign_update.rs index 0547c783..c43a0978 100755 --- a/azalea-protocol/src/packets/game/serverbound_sign_update_packet.rs +++ b/azalea-protocol/src/packets/game/s_sign_update.rs @@ -1,9 +1,9 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::position::BlockPos; use azalea_protocol_macros::ServerboundGamePacket; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSignUpdatePacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSignUpdate { pub pos: BlockPos, pub is_front_text: bool, pub lines: [String; 4], diff --git a/azalea-protocol/src/packets/game/s_swing.rs b/azalea-protocol/src/packets/game/s_swing.rs new file mode 100755 index 00000000..68648ac6 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_swing.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::game::s_interact::InteractionHand; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSwing { + pub hand: InteractionHand, +} diff --git a/azalea-protocol/src/packets/game/s_teleport_to_entity.rs b/azalea-protocol/src/packets/game/s_teleport_to_entity.rs new file mode 100755 index 00000000..e8829530 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_teleport_to_entity.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundTeleportToEntity { + pub uuid: Uuid, +} diff --git a/azalea-protocol/src/packets/game/s_use_item.rs b/azalea-protocol/src/packets/game/s_use_item.rs new file mode 100755 index 00000000..ac8ae217 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_use_item.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::game::s_interact::InteractionHand; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundUseItem { + pub hand: InteractionHand, + #[var] + pub sequence: u32, + pub yaw: f32, + pub pitch: f32, +} diff --git a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs b/azalea-protocol/src/packets/game/s_use_item_on.rs index 66048327..0ad23ad2 100755 --- a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs +++ b/azalea-protocol/src/packets/game/s_use_item_on.rs @@ -1,16 +1,16 @@ use std::io::{Cursor, Write}; -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; use azalea_core::{ direction::Direction, position::{BlockPos, Vec3}, }; use azalea_protocol_macros::ServerboundGamePacket; -use crate::packets::game::serverbound_interact_packet::InteractionHand; +use crate::packets::game::s_interact::InteractionHand; -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundUseItemOnPacket { +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundUseItemOn { pub hand: InteractionHand, pub block_hit: BlockHit, #[var] @@ -31,35 +31,35 @@ pub struct BlockHit { pub inside: bool, } -impl McBufWritable for BlockHit { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.block_pos.write_into(buf)?; - self.direction.write_into(buf)?; - f32::write_into( +impl AzaleaWrite for BlockHit { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.block_pos.azalea_write(buf)?; + self.direction.azalea_write(buf)?; + f32::azalea_write( &((self.location.x - f64::from(self.block_pos.x)) as f32), buf, )?; - f32::write_into( + f32::azalea_write( &((self.location.y - f64::from(self.block_pos.y)) as f32), buf, )?; - f32::write_into( + f32::azalea_write( &((self.location.z - f64::from(self.block_pos.z)) as f32), buf, )?; - self.inside.write_into(buf)?; + self.inside.azalea_write(buf)?; Ok(()) } } -impl McBufReadable for BlockHit { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let block_pos = BlockPos::read_from(buf)?; - let direction = Direction::read_from(buf)?; - let cursor_x = f32::read_from(buf)?; - let cursor_y = f32::read_from(buf)?; - let cursor_z = f32::read_from(buf)?; - let inside = bool::read_from(buf)?; +impl AzaleaRead for BlockHit { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let block_pos = BlockPos::azalea_read(buf)?; + let direction = Direction::azalea_read(buf)?; + let cursor_x = f32::azalea_read(buf)?; + let cursor_y = f32::azalea_read(buf)?; + let cursor_z = f32::azalea_read(buf)?; + let inside = bool::azalea_read(buf)?; Ok(Self { block_pos, direction, diff --git a/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs b/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs deleted file mode 100755 index 85311e48..00000000 --- a/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundAcceptTeleportationPacket { - #[var] - pub id: u32, -} 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 deleted file mode 100644 index d8856647..00000000 --- a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -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_ack_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_ack_packet.rs deleted file mode 100755 index eaf285cb..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_ack_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatAckPacket { - #[var] - pub messages: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs deleted file mode 100755 index 23a796d8..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatCommandPacket { - pub command: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs deleted file mode 100755 index 50b44728..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatPreviewPacket { - pub query_id: i32, - pub query: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chunk_batch_received_packet.rs b/azalea-protocol/src/packets/game/serverbound_chunk_batch_received_packet.rs deleted file mode 100644 index 9f18f967..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chunk_batch_received_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChunkBatchReceivedPacket { - pub desired_chunks_per_tick: f32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_client_command_packet.rs b/azalea-protocol/src/packets/game/serverbound_client_command_packet.rs deleted file mode 100755 index 2f360cb9..00000000 --- a/azalea-protocol/src/packets/game/serverbound_client_command_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundClientCommandPacket { - pub action: Action, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Action { - PerformRespawn = 0, - RequestStats = 1, -} diff --git a/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs b/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs deleted file mode 100755 index 37a101f5..00000000 --- a/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::configuration::serverbound_client_information_packet::ClientInformation; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundClientInformationPacket { - pub information: ClientInformation, -} diff --git a/azalea-protocol/src/packets/game/serverbound_client_tick_end_packet.rs b/azalea-protocol/src/packets/game/serverbound_client_tick_end_packet.rs deleted file mode 100644 index c843066e..00000000 --- a/azalea-protocol/src/packets/game/serverbound_client_tick_end_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundTickEndPacket {} diff --git a/azalea-protocol/src/packets/game/serverbound_command_suggestion_packet.rs b/azalea-protocol/src/packets/game/serverbound_command_suggestion_packet.rs deleted file mode 100755 index 0cca3ceb..00000000 --- a/azalea-protocol/src/packets/game/serverbound_command_suggestion_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundCommandSuggestionPacket { - #[var] - pub id: u32, - pub command: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_configuration_acknowledged_packet.rs b/azalea-protocol/src/packets/game/serverbound_configuration_acknowledged_packet.rs deleted file mode 100644 index c790972a..00000000 --- a/azalea-protocol/src/packets/game/serverbound_configuration_acknowledged_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundConfigurationAcknowledgedPacket {} diff --git a/azalea-protocol/src/packets/game/serverbound_container_button_click_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_button_click_packet.rs deleted file mode 100755 index 739e7390..00000000 --- a/azalea-protocol/src/packets/game/serverbound_container_button_click_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerButtonClickPacket { - pub container_id: u8, - pub button_id: u8, -} diff --git a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs deleted file mode 100755 index e2954720..00000000 --- a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::collections::HashMap; - -use azalea_buf::McBuf; -use azalea_inventory::{operations::ClickType, ItemSlot}; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerClickPacket { - pub container_id: u8, - #[var] - pub state_id: u32, - pub slot_num: i16, - pub button_num: u8, - pub click_type: ClickType, - pub changed_slots: HashMap<u16, ItemSlot>, - pub carried_item: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/serverbound_container_close_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_close_packet.rs deleted file mode 100755 index dbaf59f3..00000000 --- a/azalea-protocol/src/packets/game/serverbound_container_close_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerClosePacket { - pub container_id: u8, -} 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 deleted file mode 100644 index d40a59a6..00000000 --- a/azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -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/game/serverbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs deleted file mode 100755 index 7485e11e..00000000 --- a/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundKeepAlivePacket { - pub id: u64, -} diff --git a/azalea-protocol/src/packets/game/serverbound_lock_difficulty_packet.rs b/azalea-protocol/src/packets/game/serverbound_lock_difficulty_packet.rs deleted file mode 100755 index 3c54a16a..00000000 --- a/azalea-protocol/src/packets/game/serverbound_lock_difficulty_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundLockDifficultyPacket { - pub locked: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_rot_packet.rs b/azalea-protocol/src/packets/game/serverbound_move_player_rot_packet.rs deleted file mode 100755 index 11a77e73..00000000 --- a/azalea-protocol/src/packets/game/serverbound_move_player_rot_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerRotPacket { - pub y_rot: f32, - pub x_rot: f32, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_status_only_packet.rs b/azalea-protocol/src/packets/game/serverbound_move_player_status_only_packet.rs deleted file mode 100755 index fc91caca..00000000 --- a/azalea-protocol/src/packets/game/serverbound_move_player_status_only_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerStatusOnlyPacket { - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_paddle_boat_packet.rs b/azalea-protocol/src/packets/game/serverbound_paddle_boat_packet.rs deleted file mode 100755 index 2db9ef2e..00000000 --- a/azalea-protocol/src/packets/game/serverbound_paddle_boat_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPaddleBoatPacket { - pub left: bool, - pub right: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_pick_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_pick_item_packet.rs deleted file mode 100755 index 508e710b..00000000 --- a/azalea-protocol/src/packets/game/serverbound_pick_item_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPickItemPacket { - #[var] - pub slot: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_ping_request_packet.rs b/azalea-protocol/src/packets/game/serverbound_ping_request_packet.rs deleted file mode 100755 index 0966e941..00000000 --- a/azalea-protocol/src/packets/game/serverbound_ping_request_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPingRequestPacket { - pub time: u64, -} diff --git a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs deleted file mode 100755 index 900d1824..00000000 --- a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::io::Cursor; - -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::bitset::FixedBitSet; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::BufReadError; - -#[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundPlayerAbilitiesPacket { - pub is_flying: bool, -} - -impl McBufReadable for ServerboundPlayerAbilitiesPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let set = FixedBitSet::<2>::read_from(buf)?; - Ok(Self { - is_flying: set.index(1), - }) - } -} - -impl McBufWritable for ServerboundPlayerAbilitiesPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<2>::new(); - if self.is_flying { - set.set(1); - } - set.write_into(buf) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_pong_packet.rs b/azalea-protocol/src/packets/game/serverbound_pong_packet.rs deleted file mode 100755 index 17f1ac81..00000000 --- a/azalea-protocol/src/packets/game/serverbound_pong_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPongPacket { - pub id: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_rename_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_rename_item_packet.rs deleted file mode 100755 index 8308ac31..00000000 --- a/azalea-protocol/src/packets/game/serverbound_rename_item_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundRenameItemPacket { - pub name: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs b/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs deleted file mode 100755 index 54fd4cc9..00000000 --- a/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::io::Cursor; - -use azalea_buf::{McBuf, McBufReadable, McBufWritable}; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::BufReadError; - -#[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundSeenAdvancementsPacket { - pub action: Action, - pub tab: Option<ResourceLocation>, -} - -#[derive(McBuf, Clone, Copy, Debug, Eq, PartialEq)] -pub enum Action { - OpenedTab = 0, - ClosedScreen = 1, -} - -impl McBufReadable for ServerboundSeenAdvancementsPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let action = Action::read_from(buf)?; - let tab = if action == Action::OpenedTab { - Some(ResourceLocation::read_from(buf)?) - } else { - None - }; - Ok(Self { action, tab }) - } -} - -impl McBufWritable for ServerboundSeenAdvancementsPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - self.action.write_into(buf)?; - if let Some(tab) = &self.tab { - tab.write_into(buf)?; - } - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_select_trade_packet.rs b/azalea-protocol/src/packets/game/serverbound_select_trade_packet.rs deleted file mode 100755 index b13e30d5..00000000 --- a/azalea-protocol/src/packets/game/serverbound_select_trade_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSelectTradePacket { - #[var] - pub item: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_carried_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_carried_item_packet.rs deleted file mode 100755 index 044cdeb0..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_carried_item_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetCarriedItemPacket { - pub slot: u16, -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs deleted file mode 100755 index 7730bf5a..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetCreativeModeSlotPacket { - pub slot_num: u16, - pub item_stack: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/serverbound_swing_packet.rs b/azalea-protocol/src/packets/game/serverbound_swing_packet.rs deleted file mode 100755 index 53b4a6c1..00000000 --- a/azalea-protocol/src/packets/game/serverbound_swing_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::game::serverbound_interact_packet::InteractionHand; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSwingPacket { - pub hand: InteractionHand, -} diff --git a/azalea-protocol/src/packets/game/serverbound_teleport_to_entity_packet.rs b/azalea-protocol/src/packets/game/serverbound_teleport_to_entity_packet.rs deleted file mode 100755 index a7190ea5..00000000 --- a/azalea-protocol/src/packets/game/serverbound_teleport_to_entity_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundTeleportToEntityPacket { - pub uuid: Uuid, -} diff --git a/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs deleted file mode 100755 index b9f12f23..00000000 --- a/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::game::serverbound_interact_packet::InteractionHand; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundUseItemPacket { - pub hand: InteractionHand, - #[var] - pub sequence: u32, - pub yaw: f32, - pub pitch: f32, -} |
