aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-07 11:22:03 -0500
committermat <github@matdoes.dev>2022-05-07 11:22:03 -0500
commit79bf5771303c70115cba09ac55c7b7a2d3e32091 (patch)
treedb0b42f593cc45ca0a4f82f73a8bf8a116d3c693
parent34058b25283947137216964462a1370d08010066 (diff)
downloadazalea-drasl-79bf5771303c70115cba09ac55c7b7a2d3e32091.tar.xz
clientbound add player packet
-rwxr-xr-xazalea-client/src/connect.rs3
-rwxr-xr-xazalea-protocol/src/connect.rs1
-rw-r--r--azalea-protocol/src/packets/game/clientbound_add_player_packet.rs14
-rwxr-xr-xazalea-protocol/src/packets/game/mod.rs2
-rw-r--r--bot/src/main.rs2
5 files changed, 21 insertions, 1 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs
index 9d623215..a7735e0c 100755
--- a/azalea-client/src/connect.rs
+++ b/azalea-client/src/connect.rs
@@ -255,6 +255,9 @@ impl Client {
GamePacket::ClientboundSetEntityLinkPacket(p) => {
println!("Got set entity link packet {:?}", p);
}
+ GamePacket::ClientboundAddPlayerPacket(p) => {
+ println!("Got add player packet {:?}", p);
+ }
_ => panic!("Unexpected packet {:?}", packet),
}
println!();
diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs
index e9d898d6..67771d8e 100755
--- a/azalea-protocol/src/connect.rs
+++ b/azalea-protocol/src/connect.rs
@@ -10,6 +10,7 @@ use crate::ServerIpAddress;
use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
use tokio::net::TcpStream;
+#[derive(Debug, Clone, Copy)]
pub enum PacketFlow {
ClientToServer,
ServerToClient,
diff --git a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs
new file mode 100644
index 00000000..9fe086cb
--- /dev/null
+++ b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs
@@ -0,0 +1,14 @@
+use packet_macros::GamePacket;
+use uuid::Uuid;
+
+#[derive(Clone, Debug, GamePacket)]
+pub struct ClientboundAddPlayerPacket {
+ #[varint]
+ pub id: i32,
+ pub uuid: Uuid,
+ pub x: f64,
+ pub y: f64,
+ pub z: f64,
+ pub x_rot: i8,
+ pub y_rot: i8,
+}
diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs
index bdba6d2b..81980723 100755
--- a/azalea-protocol/src/packets/game/mod.rs
+++ b/azalea-protocol/src/packets/game/mod.rs
@@ -1,5 +1,6 @@
pub mod clientbound_add_entity_packet;
pub mod clientbound_add_mob_packet;
+pub mod clientbound_add_player_packet;
pub mod clientbound_change_difficulty_packet;
pub mod clientbound_custom_payload_packet;
pub mod clientbound_declare_commands_packet;
@@ -33,6 +34,7 @@ declare_state_packets!(
Clientbound => {
0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket,
0x02: clientbound_add_mob_packet::ClientboundAddMobPacket,
+ 0x04: clientbound_add_player_packet::ClientboundAddPlayerPacket,
0x0e: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
0x12: clientbound_declare_commands_packet::ClientboundDeclareCommandsPacket,
0x1a: clientbound_disconnect_packet::ClientboundDisconnectPacket,
diff --git a/bot/src/main.rs b/bot/src/main.rs
index 8314eb5c..5fbb306f 100644
--- a/bot/src/main.rs
+++ b/bot/src/main.rs
@@ -5,7 +5,7 @@ async fn main() {
println!("Hello, world!");
// let address = "95.111.249.143:10000";
- let address = "172.23.192.1:58024";
+ let address = "172.23.192.1:53911";
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
// .await
// .unwrap();