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

fix Event::Login not firing on reconnect by adding entity id to RemoveOnDisconnectBundle

This commit is contained in:
mat 2025-05-23 20:53:26 -01:00
parent 4bb317a7e1
commit acd52756be
3 changed files with 11 additions and 2 deletions

View file

@ -2,6 +2,7 @@
use azalea_chat::FormattedText; use azalea_chat::FormattedText;
use azalea_entity::{EntityBundle, InLoadedChunk, LocalEntity, metadata::PlayerMetadataBundle}; use azalea_entity::{EntityBundle, InLoadedChunk, LocalEntity, metadata::PlayerMetadataBundle};
use azalea_world::MinecraftEntityId;
use bevy_app::{App, Plugin, PostUpdate}; use bevy_app::{App, Plugin, PostUpdate};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use derive_more::Deref; use derive_more::Deref;
@ -53,6 +54,7 @@ pub struct DisconnectEvent {
pub struct RemoveOnDisconnectBundle { pub struct RemoveOnDisconnectBundle {
pub joined_client: JoinedClientBundle, pub joined_client: JoinedClientBundle,
pub entity: EntityBundle, pub entity: EntityBundle,
pub minecraft_entity_id: MinecraftEntityId,
pub instance_holder: InstanceHolder, pub instance_holder: InstanceHolder,
pub player_metadata: PlayerMetadataBundle, pub player_metadata: PlayerMetadataBundle,
pub in_loaded_chunk: InLoadedChunk, pub in_loaded_chunk: InLoadedChunk,

View file

@ -1420,8 +1420,12 @@ impl GamePacketHandler<'_> {
)>( )>(
self.ecs, self.ecs,
|(mut commands, mut query, mut events, mut instance_container, mut loaded_by_query)| { |(mut commands, mut query, mut events, mut instance_container, mut loaded_by_query)| {
let (mut instance_holder, game_profile, client_information, instance_name) = let Ok((mut instance_holder, game_profile, client_information, instance_name)) =
query.get_mut(self.player).unwrap(); query.get_mut(self.player)
else {
warn!("Got respawn packet but player doesn't have the required components");
return;
};
let new_instance_name = p.common.dimension.clone(); let new_instance_name = p.common.dimension.clone();

View file

@ -187,6 +187,9 @@ async fn handle(bot: Client, event: azalea::Event, state: State) -> anyhow::Resu
BotTask::None => {} BotTask::None => {}
} }
} }
azalea::Event::Login => {
println!("Got login event")
}
_ => {} _ => {}
} }