diff options
Diffstat (limited to 'azalea/src/container.rs')
| -rw-r--r-- | azalea/src/container.rs | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/azalea/src/container.rs b/azalea/src/container.rs index cd11b7c2..57753cc3 100644 --- a/azalea/src/container.rs +++ b/azalea/src/container.rs @@ -27,8 +27,9 @@ impl Plugin for ContainerPlugin { } pub trait ContainerClientExt { - /// Open a container in the world, like a chest. Use - /// [`Client::open_inventory`] to open your own inventory. + /// Open a container in the world, like a chest. + /// + /// Use [`Client::open_inventory`] to open your own inventory. /// /// ``` /// # use azalea::prelude::*; @@ -48,8 +49,9 @@ pub trait ContainerClientExt { &self, pos: BlockPos, ) -> impl Future<Output = Option<ContainerHandle>> + Send; - /// Open the player's inventory. This will return None if another - /// container is open. + /// Open the player's inventory. + /// + /// This will return None if another container is open. /// /// Note that this will send a packet to the server once it's dropped. Also, /// due to how it's implemented, you could call this function multiple times @@ -134,8 +136,10 @@ impl ContainerClientExt for Client { } } -/// A handle to a container that may be open. This does not close the container -/// when it's dropped. See [`ContainerHandle`] if that behavior is desired. +/// A handle to a container that may be open. +/// +/// This does not close the container when it's dropped. See [`ContainerHandle`] +/// if that behavior is desired. pub struct ContainerHandleRef { id: i32, client: Client, @@ -159,15 +163,18 @@ impl ContainerHandleRef { }); } - /// Get the id of the container. If this is 0, that means it's the player's - /// inventory. Otherwise, the number isn't really meaningful since only one - /// container can be open at a time. + /// Get the ID of the container. + /// + /// If this is 0, that means it's the player's inventory. Otherwise, the + /// number isn't really meaningful since only one container can be open + /// at a time. pub fn id(&self) -> i32 { self.id } - /// Returns the menu of the container. If the container is closed, this - /// will return `None`. + /// Returns the menu of the container. + /// + /// If the container is closed, this will return `None`. /// /// Note that any modifications you make to the `Menu` you're given will not /// actually cause any packets to be sent. If you're trying to modify your @@ -191,13 +198,16 @@ impl ContainerHandleRef { } /// Returns the item slots in the container, not including the player's - /// inventory. If the container is closed, this will return `None`. + /// inventory. + /// + /// If the container is closed, this will return `None`. pub fn contents(&self) -> Option<Vec<ItemStack>> { self.menu().map(|menu| menu.contents()) } - /// Return the contents of the menu, including the player's inventory. If - /// the container is closed, this will return `None`. + /// Return the contents of the menu, including the player's inventory. + /// + /// If the container is closed, this will return `None`. pub fn slots(&self) -> Option<Vec<ItemStack>> { self.menu().map(|menu| menu.slots()) } @@ -233,8 +243,9 @@ impl ContainerHandleRef { } } -/// A handle to the open container. The container will be closed once this is -/// dropped. +/// A handle to the open container. +/// +/// The container will be closed once this is dropped. #[derive(Deref)] pub struct ContainerHandle(ContainerHandleRef); |
