mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
fix QueryDoesNotMatch and improve error
This commit is contained in:
parent
177864be60
commit
30702d94f6
3 changed files with 10 additions and 8 deletions
|
@ -270,6 +270,7 @@ impl Client {
|
||||||
received_registries: ReceivedRegistries::default(),
|
received_registries: ReceivedRegistries::default(),
|
||||||
local_player_events: LocalPlayerEvents(tx),
|
local_player_events: LocalPlayerEvents(tx),
|
||||||
game_profile: GameProfileComponent(game_profile),
|
game_profile: GameProfileComponent(game_profile),
|
||||||
|
client_information: crate::ClientInformation::default(),
|
||||||
account: account.to_owned(),
|
account: account.to_owned(),
|
||||||
},
|
},
|
||||||
InConfigurationState,
|
InConfigurationState,
|
||||||
|
@ -593,6 +594,7 @@ pub struct LocalPlayerBundle {
|
||||||
pub received_registries: ReceivedRegistries,
|
pub received_registries: ReceivedRegistries,
|
||||||
pub local_player_events: LocalPlayerEvents,
|
pub local_player_events: LocalPlayerEvents,
|
||||||
pub game_profile: GameProfileComponent,
|
pub game_profile: GameProfileComponent,
|
||||||
|
pub client_information: ClientInformation,
|
||||||
pub account: Account,
|
pub account: Account,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,7 +606,6 @@ pub struct JoinedClientBundle {
|
||||||
pub instance_holder: InstanceHolder,
|
pub instance_holder: InstanceHolder,
|
||||||
pub physics_state: PhysicsState,
|
pub physics_state: PhysicsState,
|
||||||
pub inventory: InventoryComponent,
|
pub inventory: InventoryComponent,
|
||||||
pub client_information: ClientInformation,
|
|
||||||
pub tab_list: TabList,
|
pub tab_list: TabList,
|
||||||
pub current_sequence_number: CurrentSequenceNumber,
|
pub current_sequence_number: CurrentSequenceNumber,
|
||||||
pub last_sent_direction: LastSentLookDirection,
|
pub last_sent_direction: LastSentLookDirection,
|
||||||
|
|
|
@ -23,9 +23,10 @@ impl Client {
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn query<'w, Q: WorldQuery>(&self, ecs: &'w mut World) -> <Q as WorldQuery>::Item<'w> {
|
pub fn query<'w, Q: WorldQuery>(&self, ecs: &'w mut World) -> <Q as WorldQuery>::Item<'w> {
|
||||||
ecs.query::<Q>()
|
ecs.query::<Q>().get_mut(ecs, self.entity).expect(&format!(
|
||||||
.get_mut(ecs, self.entity)
|
"Our client is missing a required component {:?}",
|
||||||
.expect("Our client is missing a required component.")
|
std::any::type_name::<Q>()
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a lightweight [`Entity`] for the entity that matches the given
|
/// Return a lightweight [`Entity`] for the entity that matches the given
|
||||||
|
@ -66,9 +67,10 @@ impl Client {
|
||||||
pub fn entity_component<Q: Component + Clone>(&mut self, entity: Entity) -> Q {
|
pub fn entity_component<Q: Component + Clone>(&mut self, entity: Entity) -> Q {
|
||||||
let mut ecs = self.ecs.lock();
|
let mut ecs = self.ecs.lock();
|
||||||
let mut q = ecs.query::<&Q>();
|
let mut q = ecs.query::<&Q>();
|
||||||
let components = q
|
let components = q.get(&ecs, entity).expect(&format!(
|
||||||
.get(&ecs, entity)
|
"Entity is missing a required component {:?}",
|
||||||
.expect("Entity components must be present in Client::entity)components.");
|
std::any::type_name::<Q>()
|
||||||
|
));
|
||||||
components.clone()
|
components.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,6 @@ pub fn process_packet_events(ecs: &mut World) {
|
||||||
instance_holder,
|
instance_holder,
|
||||||
physics_state: crate::PhysicsState::default(),
|
physics_state: crate::PhysicsState::default(),
|
||||||
inventory: crate::inventory::InventoryComponent::default(),
|
inventory: crate::inventory::InventoryComponent::default(),
|
||||||
client_information: crate::ClientInformation::default(),
|
|
||||||
tab_list: crate::local_player::TabList::default(),
|
tab_list: crate::local_player::TabList::default(),
|
||||||
current_sequence_number: crate::interact::CurrentSequenceNumber::default(),
|
current_sequence_number: crate::interact::CurrentSequenceNumber::default(),
|
||||||
last_sent_direction: crate::movement::LastSentLookDirection::default(),
|
last_sent_direction: crate::movement::LastSentLookDirection::default(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue