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:
parent
4bb317a7e1
commit
acd52756be
3 changed files with 11 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
use azalea_chat::FormattedText;
|
||||
use azalea_entity::{EntityBundle, InLoadedChunk, LocalEntity, metadata::PlayerMetadataBundle};
|
||||
use azalea_world::MinecraftEntityId;
|
||||
use bevy_app::{App, Plugin, PostUpdate};
|
||||
use bevy_ecs::prelude::*;
|
||||
use derive_more::Deref;
|
||||
|
@ -53,6 +54,7 @@ pub struct DisconnectEvent {
|
|||
pub struct RemoveOnDisconnectBundle {
|
||||
pub joined_client: JoinedClientBundle,
|
||||
pub entity: EntityBundle,
|
||||
pub minecraft_entity_id: MinecraftEntityId,
|
||||
pub instance_holder: InstanceHolder,
|
||||
pub player_metadata: PlayerMetadataBundle,
|
||||
pub in_loaded_chunk: InLoadedChunk,
|
||||
|
|
|
@ -1420,8 +1420,12 @@ impl GamePacketHandler<'_> {
|
|||
)>(
|
||||
self.ecs,
|
||||
|(mut commands, mut query, mut events, mut instance_container, mut loaded_by_query)| {
|
||||
let (mut instance_holder, game_profile, client_information, instance_name) =
|
||||
query.get_mut(self.player).unwrap();
|
||||
let Ok((mut instance_holder, game_profile, client_information, instance_name)) =
|
||||
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();
|
||||
|
||||
|
|
|
@ -187,6 +187,9 @@ async fn handle(bot: Client, event: azalea::Event, state: State) -> anyhow::Resu
|
|||
BotTask::None => {}
|
||||
}
|
||||
}
|
||||
azalea::Event::Login => {
|
||||
println!("Got login event")
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue