diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-27 22:02:00 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-27 22:02:00 -0600 |
| commit | 9513f42e87f64c409cdb2a100500a50e5a713bac (patch) | |
| tree | bb6aa8b6d50fddf967bcb1f759e023754ea84e49 /azalea-client/src/plugins/inventory | |
| parent | 588902ba4a3965982bdd84d92b20c6f7613f3978 (diff) | |
| download | azalea-drasl-9513f42e87f64c409cdb2a100500a50e5a713bac.tar.xz | |
Move Client struct to azalea crate (#297)
* move the Client struct out of azalea-client into azalea
* actually add client impls in azalea
Diffstat (limited to 'azalea-client/src/plugins/inventory')
| -rw-r--r-- | azalea-client/src/plugins/inventory/mod.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/azalea-client/src/plugins/inventory/mod.rs b/azalea-client/src/plugins/inventory/mod.rs index 09c0d78f..740decb1 100644 --- a/azalea-client/src/plugins/inventory/mod.rs +++ b/azalea-client/src/plugins/inventory/mod.rs @@ -18,7 +18,6 @@ use indexmap::IndexMap; use tracing::{error, warn}; use crate::{ - Client, inventory::equipment_effects::{collect_equipment_changes, handle_equipment_changes}, packet::game::SendGamePacketEvent, }; @@ -56,46 +55,6 @@ impl Plugin for InventoryPlugin { #[derive(Clone, Debug, Eq, Hash, PartialEq, SystemSet)] pub struct InventorySystems; -impl Client { - /// Return the menu that is currently open, or the player's inventory if no - /// menu is open. - pub fn menu(&self) -> Menu { - self.query_self::<&Inv, _>(|inv| inv.menu().clone()) - } - - /// Returns the index of the hotbar slot that's currently selected. - /// - /// If you want to access the actual held item, you can get the current menu - /// with [`Client::menu`] and then get the slot index by offsetting from - /// the start of [`azalea_inventory::Menu::hotbar_slots_range`]. - /// - /// You can use [`Self::set_selected_hotbar_slot`] to change it. - pub fn selected_hotbar_slot(&self) -> u8 { - self.query_self::<&Inv, _>(|inv| inv.selected_hotbar_slot) - } - - /// Update the selected hotbar slot index. - /// - /// This will run next `Update`, so you might want to call - /// `bot.wait_updates(1)` after calling this if you're using `azalea`. - /// - /// # Panics - /// - /// This will panic if `new_hotbar_slot_index` is not in the range 0..=8. - pub fn set_selected_hotbar_slot(&self, new_hotbar_slot_index: u8) { - assert!( - new_hotbar_slot_index < 9, - "Hotbar slot index must be in the range 0..=8" - ); - - let mut ecs = self.ecs.lock(); - ecs.trigger(SetSelectedHotbarSlotEvent { - entity: self.entity, - slot: new_hotbar_slot_index, - }); - } -} - /// A Bevy trigger that's fired when our client should show a new screen (like a /// chest or crafting table). /// |
