diff options
| -rwxr-xr-x | azalea-chat/src/translatable_component.rs | 3 | ||||
| -rw-r--r-- | azalea-client/src/entity_query.rs | 4 | ||||
| -rw-r--r-- | azalea-inventory/azalea-inventory-macros/src/menu_impl.rs | 6 | ||||
| -rw-r--r-- | azalea/examples/testbot.rs | 2 |
4 files changed, 9 insertions, 6 deletions
diff --git a/azalea-chat/src/translatable_component.rs b/azalea-chat/src/translatable_component.rs index c633b901..eb8abcdc 100755 --- a/azalea-chat/src/translatable_component.rs +++ b/azalea-chat/src/translatable_component.rs @@ -58,7 +58,7 @@ impl TranslatableComponent { while i < template.chars().count() { if template.chars().nth(i).unwrap() == '%' { let Some(char_after) = template.chars().nth(i + 1) else { - built_text.push(template.chars().nth(i).unwrap()); + built_text.push('%'); break; }; i += 1; @@ -161,7 +161,6 @@ impl From<StringOrComponent> for TextComponent { } } -// tests #[cfg(test)] mod tests { use super::*; diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs index 0320457f..d3fa522b 100644 --- a/azalea-client/src/entity_query.rs +++ b/azalea-client/src/entity_query.rs @@ -43,7 +43,7 @@ impl Client { /// /// # fn example(mut bot: Client, sender_name: String) { /// let entity = bot.entity_by::<With<Player>, (&GameProfileComponent,)>( - /// |profile: &&GameProfileComponent| profile.name == sender_name, + /// |(profile,): &(&GameProfileComponent,)| profile.name == sender_name, /// ); /// if let Some(entity) = entity { /// let position = bot.entity_component::<Position>(entity); @@ -76,7 +76,7 @@ impl Client { pub trait EntityPredicate<Q: ReadOnlyWorldQuery, Filter: ReadOnlyWorldQuery> { fn find(&self, ecs_lock: Arc<Mutex<World>>) -> Option<Entity>; } -impl<F, Q, Filter> EntityPredicate<(Q,), Filter> for F +impl<F, Q, Filter> EntityPredicate<Q, Filter> for F where F: Fn(&ROQueryItem<Q>) -> bool, Q: ReadOnlyWorldQuery, diff --git a/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs b/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs index a4f78370..ef8f8641 100644 --- a/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs +++ b/azalea-inventory/azalea-inventory-macros/src/menu_impl.rs @@ -147,7 +147,11 @@ pub fn generate(input: &DeclareMenus) -> TokenStream { /// /// The indexes in this will match up with [`Menu::slot_mut`]. /// - /// If you don't want to include the player's inventory, use [`Menu::contents`] instead. + /// If you don't want to include the player's inventory, use [`Menu::contents`] + /// instead. + /// + /// If you *only* want to include the players inventory, then you can filter by only + /// using the slots in [`Self::player_slots_range`]. pub fn slots(&self) -> Vec<ItemSlot> { match self { #slots_match_variants diff --git a/azalea/examples/testbot.rs b/azalea/examples/testbot.rs index 9129eb3f..6fb50964 100644 --- a/azalea/examples/testbot.rs +++ b/azalea/examples/testbot.rs @@ -99,7 +99,7 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result< // .find(|e| e.name() == Some(sender)); // let entity = bot.entity_by::<With<Player>>(|name: &Name| name == sender); let entity = bot.entity_by::<With<Player>, (&GameProfileComponent,)>( - |profile: &&GameProfileComponent| { + |(profile,): &(&GameProfileComponent,)| { println!("entity {profile:?}"); profile.name == sender }, |
