Containers
Methods
Events
GetInventory
onWindowAdded
GetOpenWindow
onWindowRemoved
CloseWindows
GetWindow
GetWindowByTitle
GetWindowByType
Methods
GetInventory
Returns the Inventory of the bot. Note: IInventory extends from IWindow, which should be used as documentation when working with the inventory.
GetOpenWindow
Gets the currently open window. Note: This can return null if no window is open.
CloseWindows
Closes the currently open window, if no window is open then it will send an inventory close packet, however the server does not normally keep track if the inventory is open.
GetWindow
Gets the window by ID. Note: the bot's inventory always has the id 0, therefore if the parameter id is 0 then the bot's inventory will be returned.
GetWindowByTitle
Gets the window by title of the container. Note: the title must be unformatted/raw text, meaning it does not contain any color codes, or any text effects such as bold, or strikethrough.
GetWindowByType
Gets the window by type of container. The type of the window always starts with "minecraft:" and a list of container types can be found here.
Example code using Containers
The code below searches the bot's inventory for slots that have diamonds in them and then drops the slots that were found if they have less than 64 diamonds.
Last updated