IWindow
Represents an instance of a (usually currently open) window/container. This includes double chests, single chests, bot's inventory, etc.
Methods
Events
GetId
onSlotChanged
GetWindowType
onSlotDropped
GetWindowName
GetAt
GetSlots
IsOpen
Close
GetSlotCount
Find
FindFirst
FindByMetadata
FindFirstByMetadata
FindByType
FindBest
HasFreeSlots
GetFreeSlots
GetFreeSlot
IsEmpty
IsFull
GetAmountOfItem
MouseLeftClick
MouseRightClick
MouseShiftLeftClick
MouseMiddleClick
ClickHotbarShortcut
Take
Deposit
Methods
GetId
Gets the unique ID of the current container sent by the server.
GetWindowType
Returns the type of the current window. The type of the window always starts with "minecraft:" and a list of container types can be found here.
GetWindowName
Returns the title of the current window. This can contain color codes and text effects (e.g.: bold) and therefore IChat is returned. Use window.GetWindowName().GetText()
to get the title of the window stripped of color codes and text effects.
GetAt
Returns the slot at a given index of this window. The returned ISlot allows you to further interact with the slot (e.g.: drop it, select it, move it). Note: Containers start from index 0 at the top left. EquipmentSlots parameters can only be used on the IInventory container or IPlayerEquipmentSlots.
GetSlots
Returns either all slots for this window if includeEmpty parameter is true, otherwise it will only returns the slots that have an item in them. The returned ISlots allow you to further interact with the slots (e.g.: drop them, move them).
IsOpen
Returns whether this window is currently open.
Close
Attempts to close the current container.
Find
Returns all slot instances which match the given parameters. The parameter allow to both search based on IDs and Metadata, however metadata is optional. Note: Minecraft Block ID's can be found at https://minecraft-ids.grahamedgecombe.com/
FindFirst
Returns the first slot instance which matches the given parameters. The parameter allow to both search based on IDs and Metadata, however metadata is optional. Note: Minecraft Block ID's can be found at https://minecraft-ids.grahamedgecombe.com/ . If the window is the bot's inventory then search will start from the hotbar, whereas all other window searches start from the top left.
FindByMetadata
Returns all slot instances which match the given Metadata parameter.
FindFirstByMetaData
Returns the first slot instance which match the given Metadata parameter. Note: if the window is the bot's inventory then search will start from the hotbar, whereas all other window searches start from the top left.
FindByType
Finds all slot instances of a given type such as finding all kinds of helmets (diamond, iron, leather, etc) or all kinds of tools (diamond shovel, iron shovel, etc.) You can find the EquipmentType enum here.
FindBest
Finds the best tier item of the specified type and returns it's slot. This will look at the material of the item (e.g.: diamond vs iron) and will consider if the item has enchantments, however it will not look at the type of the enchantments. You can find the EquipmentType enum here. You can find the EquipmentSlots enum here.
HasFreeSlots
Returns whether the window has any free (non-occupied) slots. Note: you can also optionally specify how many free slots it must have, by default it is 1.
GetFreeSlots
Returns an an array of free (non-occupied) slots. Note: you can optionally specify how many free slots at most it can return, default is 255 which would return all free slots that the window has.
GetFreeSlot
Attempts to get the first free (non-occupied) slot it can find. Note: if the window is the bot's inventory then search will start from the hotbar, whereas all other window searches start from the top left.
IsEmpty
Returns true if all slots of the window are empty (non-occupied), otherwise false. Note: if the window is the bot's inventory then the armor slots and crafting slots are not taken into account.
IsFull
Returns true if all slots of the window are taken (occupied), otherwise false. Note: if the window is the bot's inventory then the armor slots and crafting slots are not taken into account.
GetAmountOfItem
Returns the amount of a given block ID there are in this window.
MouseLeftClick
Attempts to Left click on a slot at the specified index.
MouseRightClick
Attempts to Right click on a slot at the specified index.
MouseShiftLeftClick
Attempts to Shift + Left click a slot at the specified index.
MouseMiddleClick
Attempts to middle click a slot at the specified index.
ClickHotbarshortcut
Hovers the mouse over a slot, which is at the specified index, and clicks the hotbar shortcut (0-8). This can transfer items from the specified slot into the hotbar or vice-versa. Note: hotbarIndex should be a value between 0 (most left slot) and 8 (most right slot).
Take
Attempts to transfer items, that match the specified id(s) and where optionalCanBePicked optionally returns true, from the open window to the bot's inventory. You can also optionally specify the max amount of stacks the bot can take in a single function call. Note: this must be called on the window and not the bot's inventory, otherwise an exception will be thrown.
Deposit
Attempts to transfer items, that match the specified id(s) and where optionalCanBePicked optionally returns true, from the bot's inventory to the open window. Note: this must be called on the window and not the bot's inventory, otherwise an exception will be thrown.
Last updated