1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

add ResourcePackEvent event

This commit is contained in:
mat 2023-09-14 18:17:32 -05:00
parent 3621acab75
commit 6a37971420
5 changed files with 7 additions and 6 deletions

View file

@ -98,7 +98,8 @@ impl Plugin for PacketHandlerPlugin {
.add_event::<UpdatePlayerEvent>() .add_event::<UpdatePlayerEvent>()
.add_event::<ChatReceivedEvent>() .add_event::<ChatReceivedEvent>()
.add_event::<DeathEvent>() .add_event::<DeathEvent>()
.add_event::<KeepAliveEvent>(); .add_event::<KeepAliveEvent>()
.add_event::<ResourcePackEvent>();
} }
} }

View file

@ -88,7 +88,7 @@ where
P: ProtocolPacket + Debug, P: ProtocolPacket + Debug,
W: AsyncWrite + Unpin + Send, W: AsyncWrite + Unpin + Send,
{ {
trace!("Sending packet: {:?}", packet,); trace!("Sending packet: {packet:?}");
let mut buf = packet_encoder(packet).unwrap(); let mut buf = packet_encoder(packet).unwrap();
if let Some(threshold) = compression_threshold { if let Some(threshold) = compression_threshold {
buf = compression_encoder(&buf, threshold).await.unwrap(); buf = compression_encoder(&buf, threshold).await.unwrap();

View file

@ -52,7 +52,7 @@ async fn main() {
.set_handler(handle) .set_handler(handle)
.start(account.clone(), "localhost") .start(account.clone(), "localhost")
.await; .await;
eprintln!("{:?}", e); eprintln!("{e:?}");
} }
} }

View file

@ -221,12 +221,12 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result<
}; };
bot.look_at(target_pos.center()); bot.look_at(target_pos.center());
let container = bot.open_container(target_pos).await; let container = bot.open_container(target_pos).await;
println!("container: {:?}", container); println!("container: {container:?}");
if let Some(container) = container { if let Some(container) = container {
if let Some(contents) = container.contents() { if let Some(contents) = container.contents() {
for item in contents { for item in contents {
if let ItemSlot::Present(item) = item { if let ItemSlot::Present(item) = item {
println!("item: {:?}", item); println!("item: {item:?}");
} }
} }
} else { } else {

View file

@ -63,7 +63,7 @@ async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {
.dig(azalea::entity::feet_pos(bot.entity()).down(1)) .dig(azalea::entity::feet_pos(bot.entity()).down(1))
.await .await
{ {
println!("{:?}", e); println!("{e:?}");
break; break;
} }
} }