aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-14 20:03:24 -0500
committermat <github@matdoes.dev>2022-05-14 20:03:24 -0500
commitf0792f25bbbf4ab038b4c1a0cdb4294f3580b16c (patch)
tree2123987d0b52c5a6f34d6255d259acc54aec77b1
parent93730a550aed964d122bc08f5353e8eb0c5c9f31 (diff)
downloadazalea-drasl-f0792f25bbbf4ab038b4c1a0cdb4294f3580b16c.tar.xz
add derive McBuf to every packet
-rwxr-xr-xazalea-protocol/packet-macros/src/lib.rs8
-rw-r--r--azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_add_mob_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_add_player_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_animate_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_block_update_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_chat_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_game_event_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_level_event_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_light_update_packet.rs2
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_login_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_player_info_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_player_position_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_recipe_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_health_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_set_time_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_sound_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs2
-rw-r--r--azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs2
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_update_tags_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs4
-rw-r--r--azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/handshake/client_intention_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_custom_query_packet.rs4
-rw-r--r--azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/login/serverbound_hello_packet.rs4
-rw-r--r--azalea-protocol/src/packets/login/serverbound_key_packet.rs4
-rwxr-xr-xazalea-protocol/src/packets/status/serverbound_status_request_packet.rs4
-rw-r--r--code-generator/packetcodegen.py4
55 files changed, 99 insertions, 103 deletions
diff --git a/azalea-protocol/packet-macros/src/lib.rs b/azalea-protocol/packet-macros/src/lib.rs
index 59fb91eb..f3fe4e40 100755
--- a/azalea-protocol/packet-macros/src/lib.rs
+++ b/azalea-protocol/packet-macros/src/lib.rs
@@ -182,8 +182,8 @@ fn as_packet_derive(input: TokenStream, state: proc_macro2::TokenStream) -> Toke
_ => panic!("#[derive(*Packet)] can only be used on structs with named fields"),
};
- let mcbufreadable_impl = create_impl_mcbufreadable(&ident, &data);
- let mcbufwritable_impl = create_impl_mcbufwritable(&ident, &data);
+ let _mcbufreadable_impl = create_impl_mcbufreadable(&ident, &data);
+ let _mcbufwritable_impl = create_impl_mcbufwritable(&ident, &data);
let contents = quote! {
impl #ident {
@@ -202,10 +202,6 @@ fn as_packet_derive(input: TokenStream, state: proc_macro2::TokenStream) -> Toke
Ok(Self::read_into(buf)?.get())
}
}
-
- #mcbufreadable_impl
-
- #mcbufwritable_impl
};
contents.into()
diff --git a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs
index 55fbd2e1..9afd151b 100644
--- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs
@@ -1,7 +1,7 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
use uuid::Uuid;
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundAddEntityPacket {
#[var]
pub id: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_add_mob_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_mob_packet.rs
index ab72eb59..bc0ddcef 100644
--- a/azalea-protocol/src/packets/game/clientbound_add_mob_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_add_mob_packet.rs
@@ -1,7 +1,7 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
use uuid::Uuid;
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundAddMobPacket {
#[var]
pub id: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs
index 8f848c99..f1947d09 100644
--- a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs
@@ -1,7 +1,7 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
use uuid::Uuid;
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundAddPlayerPacket {
#[var]
pub id: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs b/azalea-protocol/src/packets/game/clientbound_animate_packet.rs
index 6ac4bd99..0bba1a25 100644
--- a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_animate_packet.rs
@@ -1,6 +1,6 @@
use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundAnimatePacket {
#[var]
pub id: u32,
diff --git a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs
index 575b7f46..f068cc7d 100644
--- a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs
@@ -1,7 +1,7 @@
use azalea_core::BlockPos;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundBlockUpdatePacket {
pub pos: BlockPos,
// TODO: in vanilla this is a BlockState, but here we just have it as a number.
diff --git a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs b/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs
index e12cfff3..edda52d9 100755
--- a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs
@@ -1,7 +1,7 @@
use azalea_core::difficulty::Difficulty;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundChangeDifficultyPacket {
pub difficulty: Difficulty,
pub locked: bool,
diff --git a/azalea-protocol/src/packets/game/clientbound_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_chat_packet.rs
index 7a52337e..77c5370c 100644
--- a/azalea-protocol/src/packets/game/clientbound_chat_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_chat_packet.rs
@@ -2,7 +2,7 @@ use azalea_chat::component::Component;
use packet_macros::{GamePacket, McBuf};
use uuid::Uuid;
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundChatPacket {
pub message: Component,
pub type_: ChatType,
diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
index aea09e09..d38bbfda 100644
--- a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs
@@ -1,7 +1,7 @@
use azalea_core::Slot;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundContainerSetContentPacket {
pub container_id: u8,
#[var]
diff --git a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs
index 2c56ea2b..b9ccbba4 100755
--- a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs
@@ -1,8 +1,8 @@
use crate::mc_buf::UnsizedByteArray;
use azalea_core::resource_location::ResourceLocation;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundCustomPayloadPacket {
pub identifier: ResourceLocation,
pub data: UnsizedByteArray,
diff --git a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs
index 2e72b19b..c030d512 100644
--- a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs
@@ -1,7 +1,7 @@
use azalea_chat::component::Component;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundDisconnectPacket {
pub reason: Component,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs
index 55e4d419..1b06bff7 100644
--- a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs
@@ -1,7 +1,7 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
// we can't identify the status in azalea-protocol since they vary depending on the entity
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundEntityEventPacket {
pub entity_id: i32,
pub entity_status: i8,
diff --git a/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs b/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs
index 4fc8f86f..07218c4e 100644
--- a/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundEntityVelocityPacket {
#[var]
pub entity_id: u32,
diff --git a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs
index faba0a6e..dd5f08f6 100644
--- a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs
@@ -1,6 +1,6 @@
use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundGameEventPacket {
pub event: EventType,
pub param: f32,
diff --git a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs b/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs
index 435e43cc..a522eba3 100644
--- a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundInitializeBorderPacket {
pub new_center_x: f64,
pub new_center_z: f64,
diff --git a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs
index d5dab9a9..18628c86 100644
--- a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundKeepAlivePacket {
pub id: u64,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs
index dab36050..43bda0b6 100644
--- a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs
@@ -2,7 +2,7 @@ use packet_macros::{GamePacket, McBuf};
use super::clientbound_light_update_packet::ClientboundLightUpdatePacketData;
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundLevelChunkWithLightPacket {
pub x: i32,
pub z: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs
index b8572a85..70926268 100644
--- a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs
@@ -1,7 +1,7 @@
use azalea_core::BlockPos;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundLevelEventPacket {
pub type_: i32,
pub pos: BlockPos,
diff --git a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs
index 0194d08d..43c3b31a 100644
--- a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs
@@ -1,7 +1,7 @@
use crate::mc_buf::ParticleData;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundLevelParticlesPacket {
pub particle_id: u32,
pub override_limiter: bool,
diff --git a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs
index 0c75b356..f04987ac 100644
--- a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs
@@ -1,7 +1,7 @@
use crate::mc_buf::BitSet;
use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundLightUpdatePacket {
pub x: i32,
pub z: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs
index 9c8b7df1..b4a1b8d4 100755
--- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs
@@ -1,7 +1,7 @@
use azalea_core::{game_type::GameType, resource_location::ResourceLocation};
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundLoginPacket {
pub player_id: u32,
pub hardcore: bool,
diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs
index c9aff7cb..0fc0104a 100644
--- a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundMoveEntityPosPacket {
#[var]
pub entity_id: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs
index 645912e7..5fde1b93 100644
--- a/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_move_entity_posrot_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundMoveEntityPosRotPacket {
#[var]
pub entity_id: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs
index 6ce0faa9..c8d0170b 100644
--- a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundMoveEntityRotPacket {
#[var]
pub entity_id: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs
index ed27ecf3..c3387f7f 100755
--- a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs
@@ -1,8 +1,8 @@
use crate::mc_buf::{McBufReadable, McBufWritable, Readable};
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
use std::io::{Read, Write};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundPlayerAbilitiesPacket {
pub flags: PlayerAbilitiesFlags,
pub flying_speed: f32,
diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs
index db306ade..cb17f1f5 100644
--- a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs
@@ -4,7 +4,7 @@ use packet_macros::{GamePacket, McBuf};
use std::io::{Read, Write};
use uuid::Uuid;
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundPlayerInfoPacket {
pub action: Action,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs
index 796d8334..0457269a 100644
--- a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs
@@ -1,8 +1,8 @@
use crate::mc_buf::{McBufReadable, McBufWritable, Readable};
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
use std::io::{Read, Write};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundPlayerPositionPacket {
pub x: f64,
pub y: f64,
diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs b/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs
index 9a9623ad..e76504cc 100644
--- a/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_recipe_packet.rs
@@ -3,7 +3,7 @@ use azalea_core::resource_location::ResourceLocation;
use packet_macros::{GamePacket, McBuf};
use std::io::{Read, Write};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundRecipePacket {
pub action: State,
pub settings: RecipeBookSettings,
diff --git a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs b/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs
index 265d0c64..8f51596d 100644
--- a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundRemoveEntitiesPacket {
#[var]
pub entity_ids: Vec<u32>,
diff --git a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs
index d423885d..71b485ae 100644
--- a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundRotateHeadPacket {
#[var]
pub entity_id: u32,
diff --git a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs
index 91d579a8..6c429edb 100644
--- a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs
@@ -1,9 +1,9 @@
use crate::mc_buf::{McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
use azalea_core::{ChunkSectionBlockPos, ChunkSectionPos};
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
use std::io::{Read, Write};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSectionBlocksUpdatePacket {
pub section_pos: ChunkSectionPos,
pub suppress_light_updates: bool,
diff --git a/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs
index 4f0bf575..003b6ccc 100755
--- a/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_carried_item_packet.rs
@@ -1,7 +1,7 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
/// Sent to change the player's slot selection.
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetCarriedItemPacket {
pub slot: u8,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center.rs b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center.rs
index 60f2ab94..7557c16b 100644
--- a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetChunkCacheCenterPacket {
#[var]
pub x: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs
index dad050cc..7ac42c5c 100644
--- a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs
@@ -1,7 +1,7 @@
use azalea_core::BlockPos;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetDefaultSpawnPositionPacket {
pub pos: BlockPos,
pub angle: f32,
diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs
index 752b7e6a..8a568689 100644
--- a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs
@@ -1,7 +1,7 @@
use crate::mc_buf::EntityMetadata;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetEntityDataPacket {
#[var]
pub id: i32,
diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs
index 7ee4a43c..e6e3af67 100644
--- a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetEntityLinkPacket {
pub source_id: u32,
pub dest_id: u32,
diff --git a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs
index 88c306dc..bcb6393d 100644
--- a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetExperiencePacket {
pub experience_progress: f32,
#[var]
diff --git a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs
index 136ef475..6c75cf63 100644
--- a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetHealthPacket {
pub health: f32,
#[var]
diff --git a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs
index 02bf88d7..4cad0693 100644
--- a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSetTimePacket {
pub game_time: u64,
pub day_time: u64,
diff --git a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs
index 8094227b..797f03de 100644
--- a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs
@@ -1,6 +1,6 @@
use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundSoundPacket {
#[var]
/// TODO: use the sound registry instead of just being a u32
diff --git a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs
index ea8788d6..c10db7b9 100644
--- a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundTeleportEntityPacket {
#[var]
pub id: u32,
diff --git a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs
index 0bd18319..daa1ac93 100644
--- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs
@@ -7,7 +7,7 @@ use std::{
io::{Read, Write},
};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundUpdateAdvancementsPacket {
pub reset: bool,
pub added: HashMap<ResourceLocation, Advancement>,
diff --git a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
index 2b382c9f..d0e7c9ee 100644
--- a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
@@ -4,7 +4,7 @@ use packet_macros::{GamePacket, McBuf};
use std::io::{Read, Write};
use uuid::Uuid;
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundUpdateAttributesPacket {
#[var]
pub entity_id: u32,
diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs
index e7756248..27839919 100644
--- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs
@@ -5,7 +5,7 @@ use packet_macros::{GamePacket, McBuf};
use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundUpdateRecipesPacket {
pub recipes: Vec<Recipe>,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs
index f82a4177..60794f03 100755
--- a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs
@@ -1,12 +1,12 @@
use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable};
use azalea_core::resource_location::ResourceLocation;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
use std::{
collections::HashMap,
io::{Read, Write},
};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundUpdateTagsPacket {
pub tags: HashMap<ResourceLocation, Vec<Tags>>,
}
diff --git a/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs
index fe65d048..8288bd73 100755
--- a/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_view_distance_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundUpdateViewDistancePacket {
#[var]
pub view_distance: i32,
diff --git a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs
index eefafdd1..bef25b59 100644
--- a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs
@@ -1,8 +1,8 @@
use crate::mc_buf::UnsizedByteArray;
use azalea_core::resource_location::ResourceLocation;
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ServerboundCustomPayloadPacket {
pub identifier: ResourceLocation,
pub data: UnsizedByteArray,
diff --git a/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs
index 740b18e3..c430499e 100644
--- a/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs
+++ b/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs
@@ -1,6 +1,6 @@
-use packet_macros::GamePacket;
+use packet_macros::{GamePacket, McBuf};
-#[derive(Clone, Debug, GamePacket)]
+#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ServerboundKeepAlivePacket {
pub id: u64,
}
diff --git a/azalea-protocol/src/packets/handshake/client_intention_packet.rs b/azalea-protocol/src/packets/handshake/client_intention_packet.rs
index 98caf34c..410c11ab 100755
--- a/azalea-protocol/src/packets/handshake/client_intention_packet.rs
+++ b/azalea-protocol/src/packets/handshake/client_intention_packet.rs
@@ -1,8 +1,8 @@
use crate::packets::ConnectionProtocol;
-use packet_macros::HandshakePacket;
+use packet_macros::{HandshakePacket, McBuf};
use std::hash::Hash;
-#[derive(Hash, Clone, Debug, HandshakePacket)]
+#[derive(Hash, Clone, Debug, McBuf, HandshakePacket)]
pub struct ClientIntentionPacket {
#[var]
pub protocol_version: u32,
diff --git a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
index fc5dd1a2..1b1da87a 100755
--- a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs
@@ -1,9 +1,9 @@
use crate::mc_buf::UnsizedByteArray;
use azalea_core::resource_location::ResourceLocation;
-use packet_macros::LoginPacket;
+use packet_macros::{LoginPacket, McBuf};
use std::hash::Hash;
-#[derive(Hash, Clone, Debug, LoginPacket)]
+#[derive(Hash, Clone, Debug, McBuf, LoginPacket)]
pub struct ClientboundCustomQueryPacket {
#[var]
pub transaction_id: u32,
diff --git a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs
index 28d91c79..9ab09e3b 100644
--- a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs
@@ -1,7 +1,7 @@
use azalea_chat::component::Component;
-use packet_macros::LoginPacket;
+use packet_macros::{LoginPacket, McBuf};
-#[derive(Clone, Debug, LoginPacket)]
+#[derive(Clone, Debug, McBuf, LoginPacket)]
pub struct ClientboundLoginDisconnectPacket {
pub reason: Component,
}
diff --git a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs b/azalea-protocol/src/packets/login/serverbound_hello_packet.rs
index eb6a4065..5cb660ed 100755
--- a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs
+++ b/azalea-protocol/src/packets/login/serverbound_hello_packet.rs
@@ -1,7 +1,7 @@
-use packet_macros::LoginPacket;
+use packet_macros::{LoginPacket, McBuf};
use std::hash::Hash;
-#[derive(Hash, Clone, Debug, LoginPacket)]
+#[derive(Hash, Clone, Debug, McBuf, LoginPacket)]
pub struct ServerboundHelloPacket {
pub username: String,
}
diff --git a/azalea-protocol/src/packets/login/serverbound_key_packet.rs b/azalea-protocol/src/packets/login/serverbound_key_packet.rs
index 2ff8dda6..9100823d 100644
--- a/azalea-protocol/src/packets/login/serverbound_key_packet.rs
+++ b/azalea-protocol/src/packets/login/serverbound_key_packet.rs
@@ -1,7 +1,7 @@
-use packet_macros::LoginPacket;
+use packet_macros::{LoginPacket, McBuf};
use std::hash::Hash;
-#[derive(Hash, Clone, Debug, LoginPacket)]
+#[derive(Hash, Clone, Debug, McBuf, LoginPacket)]
pub struct ServerboundKeyPacket {
pub shared_secret: Vec<u8>,
pub nonce: Vec<u8>,
diff --git a/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs b/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs
index c15673d9..3369e6a9 100755
--- a/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs
+++ b/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs
@@ -1,4 +1,4 @@
-use packet_macros::StatusPacket;
+use packet_macros::{McBuf, StatusPacket};
-#[derive(Clone, Debug, StatusPacket)]
+#[derive(Clone, Debug, McBuf, StatusPacket)]
pub struct ServerboundStatusRequestPacket {}
diff --git a/code-generator/packetcodegen.py b/code-generator/packetcodegen.py
index fbb38eeb..b84877e4 100644
--- a/code-generator/packetcodegen.py
+++ b/code-generator/packetcodegen.py
@@ -84,8 +84,8 @@ def generate(burger_packets, mappings: Mappings, target_packet_id, target_packet
generated_packet_code = []
uses = set()
generated_packet_code.append(
- f'#[derive(Clone, Debug, {to_camel_case(state)}Packet)]')
- uses.add(f'packet_macros::{to_camel_case(state)}Packet')
+ f'#[derive(Clone, Debug, McBuf, {to_camel_case(state)}Packet)]')
+ uses.add(f'packet_macros::{{to_camel_case(state)}Packet, McBuf}')
obfuscated_class_name = packet['class'].split('.')[0].split('$')[0]
class_name = mappings.get_class(