From d99ba0da5500a1a4917bf9c8c9e93e2caa4ada99 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 23 Jul 2023 22:17:17 -0500 Subject: clean up azalea-entity a little --- azalea-client/src/packet_handling.rs | 13 ++++++------- azalea-client/src/player.rs | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'azalea-client/src') diff --git a/azalea-client/src/packet_handling.rs b/azalea-client/src/packet_handling.rs index 547b1b4b..d72a06b2 100644 --- a/azalea-client/src/packet_handling.rs +++ b/azalea-client/src/packet_handling.rs @@ -2,9 +2,10 @@ use std::{collections::HashSet, io::Cursor, sync::Arc}; use azalea_core::{ChunkPos, GameMode, ResourceLocation, Vec3}; use azalea_entity::{ + indexing::EntityUuidIndex, metadata::{apply_metadata, Health, PlayerMetadataBundle}, - Dead, EntityBundle, EntityInfos, EntityKind, EntityUpdateSet, LastSentPosition, LoadedBy, - LookDirection, Physics, PlayerBundle, Position, RelativeEntityUpdate, + Dead, EntityBundle, EntityKind, EntityUpdateSet, LastSentPosition, LoadedBy, LookDirection, + Physics, PlayerBundle, Position, RelativeEntityUpdate, }; use azalea_protocol::{ connect::{ReadConnection, WriteConnection}, @@ -579,9 +580,9 @@ fn process_packet_events(ecs: &mut World) { Commands, Query>, Res, - ResMut, + ResMut, )> = SystemState::new(ecs); - let (mut commands, mut query, instance_container, mut entity_infos) = + let (mut commands, mut query, instance_container, mut entity_uuid_index) = system_state.get_mut(ecs); let instance_name = query.get_mut(player_entity).unwrap(); @@ -601,9 +602,7 @@ fn process_packet_events(ecs: &mut World) { .write() .entity_by_id .insert(MinecraftEntityId(p.id), entity_commands.id()); - entity_infos - .entity_by_uuid - .insert(p.uuid, entity_commands.id()); + entity_uuid_index.insert(p.uuid, entity_commands.id()); } // the bundle doesn't include the default entity metadata so we add that diff --git a/azalea-client/src/player.rs b/azalea-client/src/player.rs index 25ba0d8c..a94340ab 100755 --- a/azalea-client/src/player.rs +++ b/azalea-client/src/player.rs @@ -1,7 +1,7 @@ use azalea_auth::game_profile::GameProfile; use azalea_chat::FormattedText; use azalea_core::GameMode; -use azalea_entity::EntityInfos; +use azalea_entity::indexing::EntityUuidIndex; use bevy_ecs::{ event::EventReader, system::{Commands, Res}, @@ -35,10 +35,10 @@ pub struct PlayerInfo { pub fn retroactively_add_game_profile_component( mut commands: Commands, mut events: EventReader, - entity_infos: Res, + entity_uuid_index: Res, ) { for event in events.iter() { - if let Some(entity) = entity_infos.get_entity_by_uuid(&event.info.uuid) { + if let Some(entity) = entity_uuid_index.get(&event.info.uuid) { commands .entity(entity) .insert(GameProfileComponent(event.info.profile.clone())); -- cgit v1.2.3