diff options
| author | mat <github@matdoes.dev> | 2022-05-07 11:58:00 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-05-07 11:58:00 -0500 |
| commit | b9c31efc0161457771861e6858a4a4da0b6a2727 (patch) | |
| tree | 5ce24cf6e79f8fb640b4213bc60597f89b2f0bae /azalea-protocol/src/packets | |
| parent | 79bf5771303c70115cba09ac55c7b7a2d3e32091 (diff) | |
| download | azalea-drasl-b9c31efc0161457771861e6858a4a4da0b6a2727.tar.xz | |
Initialize worldborder packet
Also add varlong and replace #[varint] with #[var]
Diffstat (limited to 'azalea-protocol/src/packets')
17 files changed, 49 insertions, 30 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs index f45e71c9..55fbd2e1 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs @@ -3,11 +3,11 @@ use uuid::Uuid; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundAddEntityPacket { - #[varint] + #[var] pub id: i32, pub uuid: Uuid, // TODO: have an entity type struct - #[varint] + #[var] pub entity_type: i32, pub x: f64, pub y: f64, 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 144e74c8..ab72eb59 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_mob_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_mob_packet.rs @@ -3,11 +3,11 @@ use uuid::Uuid; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundAddMobPacket { - #[varint] + #[var] pub id: i32, pub uuid: Uuid, // TODO: have an entity type struct - #[varint] + #[var] pub entity_type: i32, pub x: f64, pub y: f64, 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 9fe086cb..8f848c99 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs @@ -3,7 +3,7 @@ use uuid::Uuid; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundAddPlayerPacket { - #[varint] + #[var] pub id: i32, pub uuid: Uuid, pub x: f64, 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 94061c51..4fc8f86f 100644 --- a/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_entity_velocity_packet.rs @@ -2,7 +2,7 @@ use packet_macros::GamePacket; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundEntityVelocityPacket { - #[varint] + #[var] pub entity_id: u32, pub x_vel: i16, pub y_vel: i16, diff --git a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs b/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs new file mode 100644 index 00000000..435e43cc --- /dev/null +++ b/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs @@ -0,0 +1,17 @@ +use packet_macros::GamePacket; + +#[derive(Clone, Debug, GamePacket)] +pub struct ClientboundInitializeBorderPacket { + pub new_center_x: f64, + pub new_center_z: f64, + pub old_size: f64, + pub new_size: f64, + #[var] + pub lerp_time: u64, + #[var] + pub new_absolute_max_size: u32, + #[var] + pub warning_blocks: u32, + #[var] + pub warning_time: u32, +} 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 1d017c2a..22eedb05 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 @@ -22,7 +22,7 @@ pub struct ClientboundLevelChunkPacketData { pub struct BlockEntity { packed_xz: u8, y: u16, - #[varint] + #[var] type_: i32, data: azalea_nbt::Tag, } diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs index 929b11cd..9c8b7df1 100755 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_login_packet.rs @@ -12,11 +12,11 @@ pub struct ClientboundLoginPacket { pub dimension_type: azalea_nbt::Tag, pub dimension: ResourceLocation, pub seed: i64, - #[varint] + #[var] pub max_players: i32, - #[varint] + #[var] pub chunk_radius: i32, - #[varint] + #[var] pub simulation_distance: i32, pub reduced_debug_info: bool, pub show_death_screen: bool, 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 9c34d06e..8e7ce4fd 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs @@ -30,9 +30,9 @@ pub struct AddPlayer { uuid: Uuid, name: String, properties: Vec<PlayerProperty>, - #[varint] + #[var] gamemode: u32, - #[varint] + #[var] ping: i32, display_name: Option<Component>, } @@ -40,14 +40,14 @@ pub struct AddPlayer { #[derive(Clone, Debug, McBufReadable, McBufWritable)] pub struct UpdateGameMode { uuid: Uuid, - #[varint] + #[var] gamemode: u32, } #[derive(Clone, Debug, McBufReadable, McBufWritable)] pub struct UpdateLatency { uuid: Uuid, - #[varint] + #[var] ping: i32, } 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 cac4665d..86266e9f 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs @@ -12,7 +12,7 @@ pub struct ClientboundPlayerPositionPacket { pub relative_arguments: RelativeArguments, /// Client should confirm this packet with Teleport Confirm containing the /// same Teleport ID. - #[varint] + #[var] pub id: i32, pub dismount_vehicle: bool, } 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 482dc0c7..f4d59e32 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 @@ -2,8 +2,8 @@ use packet_macros::GamePacket; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundSetChunkCacheCenterPacket { - #[varint] + #[var] pub x: i32, - #[varint] + #[var] pub y: i32, } 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 5d288518..03df8e13 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 @@ -10,7 +10,7 @@ use uuid::Uuid; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundSetEntityDataPacket { - #[varint] + #[var] pub id: i32, pub metadata: Vec<EntityDataItem>, } @@ -142,17 +142,17 @@ pub enum Pose { #[derive(Debug, Clone, McBufReadable, McBufWritable)] pub struct VillagerData { - #[varint] + #[var] type_: u32, - #[varint] + #[var] profession: u32, - #[varint] + #[var] level: u32, } #[derive(Debug, Clone, McBufReadable, McBufWritable)] pub struct Particle { - #[varint] + #[var] pub id: i32, pub data: ParticleData, } @@ -251,7 +251,7 @@ pub enum ParticleData { #[derive(Debug, Clone, McBufReadable, McBufWritable)] pub struct BlockParticle { - #[varint] + #[var] pub block_state: i32, } #[derive(Debug, Clone, McBufReadable, McBufWritable)] @@ -294,9 +294,9 @@ pub struct VibrationParticle { pub origin: BlockPos, pub position_type: String, pub block_position: BlockPos, - #[varint] + #[var] pub entity_id: u32, - #[varint] + #[var] pub ticks: u32, } diff --git a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs index 82f34f96..3d83e6fb 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs @@ -6,7 +6,7 @@ use uuid::Uuid; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundUpdateAttributesPacket { - #[varint] + #[var] pub entity_id: u32, pub attributes: Vec<AttributeSnapshot>, } 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 d15e10c3..1c87a472 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -74,7 +74,7 @@ pub struct CookingRecipe { ingredient: Ingredient, result: Slot, experience: f32, - #[varint] + #[var] cooking_time: u32, } #[derive(Clone, Debug, McBufReadable, McBufWritable)] 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 1f988fe5..fe65d048 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 @@ -2,6 +2,6 @@ use packet_macros::GamePacket; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundUpdateViewDistancePacket { - #[varint] + #[var] pub view_distance: i32, } diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index 81980723..852a9525 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -7,6 +7,7 @@ pub mod clientbound_declare_commands_packet; pub mod clientbound_disconnect_packet; pub mod clientbound_entity_event_packet; pub mod clientbound_entity_velocity_packet; +pub mod clientbound_initialize_border_packet; pub mod clientbound_level_chunk_with_light_packet; pub mod clientbound_light_update_packet; pub mod clientbound_login_packet; @@ -40,6 +41,7 @@ declare_state_packets!( 0x1a: clientbound_disconnect_packet::ClientboundDisconnectPacket, 0x1b: clientbound_entity_event_packet::ClientboundEntityEventPacket, 0x18: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, + 0x20: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket, 0x22: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, 0x25: clientbound_light_update_packet::ClientboundLightUpdatePacket, 0x26: clientbound_login_packet::ClientboundLoginPacket, diff --git a/azalea-protocol/src/packets/handshake/client_intention_packet.rs b/azalea-protocol/src/packets/handshake/client_intention_packet.rs index 6216ddc4..98caf34c 100755 --- a/azalea-protocol/src/packets/handshake/client_intention_packet.rs +++ b/azalea-protocol/src/packets/handshake/client_intention_packet.rs @@ -4,7 +4,7 @@ use std::hash::Hash; #[derive(Hash, Clone, Debug, HandshakePacket)] pub struct ClientIntentionPacket { - #[varint] + #[var] pub protocol_version: u32, pub hostname: String, pub port: u16, 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 9e1e1df5..fc5dd1a2 100755 --- a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs @@ -5,7 +5,7 @@ use std::hash::Hash; #[derive(Hash, Clone, Debug, LoginPacket)] pub struct ClientboundCustomQueryPacket { - #[varint] + #[var] pub transaction_id: u32, pub identifier: ResourceLocation, pub data: UnsizedByteArray, |
