From cbc6af81fbdee71f4c1c7d62e1b91f8b17ad23bd Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 26 Feb 2023 15:07:52 -0600 Subject: Add PacketEvent (#75) * add PacketEvent * docs and fixes * Event::Packet works --- azalea/examples/testbot.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'azalea/examples') diff --git a/azalea/examples/testbot.rs b/azalea/examples/testbot.rs index 053e29b3..55c440a2 100644 --- a/azalea/examples/testbot.rs +++ b/azalea/examples/testbot.rs @@ -9,6 +9,7 @@ use azalea::pathfinder::BlockPosGoal; use azalea::{prelude::*, swarm::prelude::*, BlockPos, GameProfileComponent, WalkDirection}; use azalea::{Account, Client, Event}; use azalea_protocol::packets::game::serverbound_client_command_packet::ServerboundClientCommandPacket; +use azalea_protocol::packets::game::ClientboundGamePacket; use std::time::Duration; #[derive(Default, Clone, Component)] @@ -148,6 +149,12 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result< action: azalea_protocol::packets::game::serverbound_client_command_packet::Action::PerformRespawn, }.get()); } + Event::Packet(packet) => match *packet { + ClientboundGamePacket::Login(_) => { + println!("login packet"); + } + _ => {} + }, _ => {} } -- cgit v1.2.3