From 90d6b0acea7183d1a3b05d9a92825fa30b02c1cc Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 14 Sep 2023 18:29:28 -0500 Subject: fix unknown entity warnings --- azalea-client/src/packet_handling.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/azalea-client/src/packet_handling.rs b/azalea-client/src/packet_handling.rs index ca96d728..de88665e 100644 --- a/azalea-client/src/packet_handling.rs +++ b/azalea-client/src/packet_handling.rs @@ -220,11 +220,16 @@ pub fn process_packet_events(ecs: &mut World) { #[allow(clippy::type_complexity)] let mut system_state: SystemState<( Commands, - Query<(&mut LocalPlayer, &GameProfileComponent, &ClientInformation)>, + Query<( + &mut LocalPlayer, + &mut EntityIdIndex, + &GameProfileComponent, + &ClientInformation, + )>, ResMut, )> = SystemState::new(ecs); let (mut commands, mut query, mut instance_container) = system_state.get_mut(ecs); - let (mut local_player, game_profile, client_information) = + let (mut local_player, mut entity_id_index, game_profile, client_information) = query.get_mut(player_entity).unwrap(); { @@ -283,6 +288,9 @@ pub fn process_packet_events(ecs: &mut World) { received_registries, player_bundle, )); + + // add our own player to our index + entity_id_index.insert(MinecraftEntityId(p.player_id), player_entity); } // brand @@ -579,7 +587,7 @@ pub fn process_packet_events(ecs: &mut World) { } } ClientboundGamePacket::AddEntity(p) => { - debug!("Got add entity packet {:?}", p); + debug!("Got add entity packet {p:?}"); #[allow(clippy::type_complexity)] let mut system_state: SystemState<( @@ -657,10 +665,10 @@ pub fn process_packet_events(ecs: &mut World) { // debug!("Got entity velocity packet {:?}", p); } ClientboundGamePacket::SetEntityLink(p) => { - debug!("Got set entity link packet {:?}", p); + debug!("Got set entity link packet {p:?}"); } ClientboundGamePacket::AddPlayer(p) => { - debug!("Got add player packet {:?}", p); + debug!("Got add player packet {p:?}"); #[allow(clippy::type_complexity)] let mut system_state: SystemState<( -- cgit v1.2.3