Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20.5 #127

Merged
merged 16 commits into from
Apr 23, 2024
Merged
2 changes: 1 addition & 1 deletion azalea-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl Client {
match packet {
ClientboundLoginPacket::Hello(p) => {
debug!("Got encryption request");
let e = azalea_crypto::encrypt(&p.public_key, &p.nonce).unwrap();
let e = azalea_crypto::encrypt(&p.public_key, &p.challenge).unwrap();

if let Some(access_token) = &account.access_token {
// keep track of the number of times we tried
Expand Down
5 changes: 5 additions & 0 deletions azalea-client/src/packet_handling/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ pub fn process_packet_events(ecs: &mut World) {
ClientboundConfigurationPacket::UpdateTags(_p) => {
debug!("Got update tags packet");
}
ClientboundConfigurationPacket::CookieRequest(_) => {}
ClientboundConfigurationPacket::ResetChat(_) => {}
ClientboundConfigurationPacket::StoreCookie(_) => {}
ClientboundConfigurationPacket::Transfer(_) => {}
ClientboundConfigurationPacket::SelectKnownPacks(_) => {}
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions azalea-client/src/packet_handling/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,9 +1288,6 @@ pub fn process_packet_events(ecs: &mut World) {
packet: ServerboundPongPacket { id: p.id }.get(),
});
}
ClientboundGamePacket::PongResponse(p) => {
debug!("Got pong response packet {p:?}");
}
ClientboundGamePacket::PlaceGhostRecipe(_) => {}
ClientboundGamePacket::PlayerCombatEnd(_) => {}
ClientboundGamePacket::PlayerCombatEnter(_) => {}
Expand Down Expand Up @@ -1475,6 +1472,11 @@ pub fn process_packet_events(ecs: &mut World) {
ClientboundGamePacket::TickingStep(_) => {}

ClientboundGamePacket::ResetScore(_) => {}
ClientboundGamePacket::CookieRequest(_) => {}
ClientboundGamePacket::DebugSample(_) => {}
ClientboundGamePacket::PongResponse(_) => {}
ClientboundGamePacket::StoreCookie(_) => {}
ClientboundGamePacket::Transfer(_) => {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundConfigurationPacket;

#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
pub struct ClientboundResetChatPacket {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundConfigurationPacket;

use super::serverbound_select_known_packs_packet::KnownPack;

#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
pub struct ClientboundSelectKnownPacksPacket {
pub known_packs: Vec<KnownPack>,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use azalea_buf::McBuf;
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigurationPacket;

#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
pub struct ClientboundStoreCookiePacket {
pub key: ResourceLocation,
pub payload: Vec<u8>,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundConfigurationPacket;

#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
pub struct ClientboundTransferPacket {
pub host: String,
#[var]
pub port: u32,
}
55 changes: 37 additions & 18 deletions azalea-protocol/src/packets/configuration/mod.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,56 @@
pub mod serverbound_cookie_response_packet;
pub mod clientbound_cookie_request_packet;
pub mod serverbound_client_information_packet;
pub mod serverbound_custom_payload_packet;
pub mod serverbound_keep_alive_packet;
pub mod serverbound_pong_packet;
pub mod serverbound_resource_pack_packet;
pub mod clientbound_custom_payload_packet;
pub mod clientbound_disconnect_packet;
pub mod clientbound_finish_configuration_packet;
pub mod clientbound_keep_alive_packet;
pub mod clientbound_ping_packet;
pub mod clientbound_registry_data_packet;
pub mod clientbound_reset_chat_packet;
pub mod clientbound_resource_pack_pop_packet;
pub mod clientbound_resource_pack_push_packet;
pub mod clientbound_select_known_packs_packet;
pub mod clientbound_store_cookie_packet;
pub mod clientbound_transfer_packet;
pub mod clientbound_update_enabled_features_packet;
pub mod clientbound_update_tags_packet;
pub mod serverbound_client_information_packet;
pub mod serverbound_cookie_response_packet;
pub mod serverbound_custom_payload_packet;
pub mod serverbound_finish_configuration_packet;
pub mod serverbound_keep_alive_packet;
pub mod serverbound_pong_packet;
pub mod serverbound_resource_pack_packet;
pub mod serverbound_select_known_packs_packet;

use azalea_protocol_macros::declare_state_packets;

declare_state_packets!(
ConfigurationPacket,
Serverbound => {
0x00: serverbound_client_information_packet::ServerboundClientInformationPacket,
0x01: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
0x01: serverbound_cookie_response_packet::ServerboundCookieResponsePacket,
0x03: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
0x04: serverbound_pong_packet::ServerboundPongPacket,
0x05: serverbound_resource_pack_packet::ServerboundResourcePackPacket,
0x02: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
0x03: serverbound_finish_configuration_packet::ServerboundFinishConfigurationPacket,
0x04: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
0x05: serverbound_pong_packet::ServerboundPongPacket,
0x06: serverbound_resource_pack_packet::ServerboundResourcePackPacket,
0x07: serverbound_select_known_packs_packet::ServerboundSelectKnownPacksPacket,
},
Clientbound => {
0x00: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket,
0x00: clientbound_cookie_request_packet::ClientboundCookieRequestPacket,
0x01: clientbound_disconnect_packet::ClientboundDisconnectPacket,
0x03: clientbound_keep_alive_packet::ClientboundKeepAlivePacket,
0x04: clientbound_ping_packet::ClientboundPingPacket,
0x06: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket,
0x07: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket,
0x09: clientbound_update_tags_packet::ClientboundUpdateTagsPacket,
0x01: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket,
0x02: clientbound_disconnect_packet::ClientboundDisconnectPacket,
0x03: clientbound_finish_configuration_packet::ClientboundFinishConfigurationPacket,
0x04: clientbound_keep_alive_packet::ClientboundKeepAlivePacket,
0x05: clientbound_ping_packet::ClientboundPingPacket,
0x06: clientbound_reset_chat_packet::ClientboundResetChatPacket,
0x07: clientbound_registry_data_packet::ClientboundRegistryDataPacket,
0x08: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket,
0x09: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket,
0x0a: clientbound_store_cookie_packet::ClientboundStoreCookiePacket,
0x0b: clientbound_transfer_packet::ClientboundTransferPacket,
0x0c: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket,
0x0d: clientbound_update_tags_packet::ClientboundUpdateTagsPacket,
0x0e: clientbound_select_known_packs_packet::ClientboundSelectKnownPacksPacket,
}
);
);
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use azalea_buf::McBuf;
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ServerboundConfigurationPacket;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)]
pub struct ServerboundCookieResponsePacket {
pub key: ResourceLocation,
pub payload: Option<(u32, Vec<u8>)>,
}
pub key: ResourceLocation,
pub payload: Option<Vec<u8>>,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ServerboundConfigurationPacket;

#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)]
pub struct ServerboundSelectKnownPacksPacket {
pub known_packs: Vec<KnownPack>,
}

#[derive(Clone, Debug, McBuf)]
pub struct KnownPack {
pub namespace: String,
pub id: String,
pub version: String,
}
56 changes: 33 additions & 23 deletions azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
use uuid::Uuid;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_buf::McBuf;
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 {
#[var]
pub id: u32,
pub uuid: Uuid,
pub x: f64,
pub y: f64,
pub z: f64,
#[var]
pub x_rot: i32,
#[var]
pub y_rot: i32,
#[var]
pub y_head_rot: i32,
#[var]
pub data: u32,
#[var]
pub xa: i32,
#[var]
pub ya: i32,
#[var]
pub za: i32,
}
/// The id of the entity.
#[var]
pub id: u32,
pub uuid: Uuid,
pub entity_type: azalea_registry::EntityKind,
pub position: Vec3,
pub x_rot: i8,
pub y_rot: i8,
pub y_head_rot: i8,
#[var]
pub data: i32,
pub x_vel: i16,
pub y_vel: i16,
pub z_vel: i16,
}

impl ClientboundAddEntityPacket {
/// Make the entity into a bundle that can be inserted into the ECS. You
/// must apply the metadata after inserting the bundle with
/// [`Self::apply_metadata`].
pub fn as_entity_bundle(&self, world_name: ResourceLocation) -> EntityBundle {
EntityBundle::new(self.uuid, self.position, self.entity_type, world_name)
}

/// Apply the default metadata for the given entity.
pub fn apply_metadata(&self, entity: &mut bevy_ecs::system::EntityCommands) {
apply_default_metadata(entity, self.entity_type);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_block::BlockState;
use azalea_buf::McBuf;
use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundBlockUpdatePacket {
}
pub pos: BlockPos,
pub block_state: BlockState,
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_buf::McBuf;
use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetContentPacket {
#[var]
pub container_id: u32,
#[var]
pub state_id: u32,
}
pub container_id: i8,
#[var]
pub state_id: u32,
pub items: Vec<ItemSlot>,
pub carried_item: ItemSlot,
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_buf::McBuf;
use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundContainerSetSlotPacket {
#[var]
pub container_id: u32,
#[var]
pub state_id: u32,
#[var]
pub slot: u32,
}
pub container_id: i8,
#[var]
pub state_id: u32,
pub slot: u16,
pub item_stack: ItemSlot,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use azalea_buf::McBuf;
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundCookieRequestPacket {
pub key: ResourceLocation,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundGamePacket;

use super::serverbound_debug_sample_subscription::RemoteDebugSampleType;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundDebugSamplePacket {
pub sample: Vec<u64>,
pub debug_sample_type: RemoteDebugSampleType,
}
Loading