Table of Contents generated with DocToc
- windows.createWindow(id, type, title, slotCount = undefined)
- windows.Window (base class)
- properties
- Methods
- window.acceptClick(click)
- window.acceptOutsideWindowClick(click)
- window.acceptInventoryClick(click)
- window.acceptNonInventorySwapAreaClick(click)
- window.acceptSwapAreaRightClick(click)
- window.acceptSwapAreaLeftClick(click)
- window.acceptCraftingClick(click)
- window.updateSlot(slot, newItem)
- window.findItemRange(start, end, itemType, metadata, [notFull], null)
- window.findItemRangeName(start, end, itemName, metadata, [notFull])
- window.findInventoryItem(item, metadata, [notFull])
- window.findContainerItem(item, metadata, [notFull])
- window.firstEmptySlotRange(start, end)
- window.firstEmptyHotbarSlot()
- window.firstEmptyContainerSlot()
- window.firstEmptyInventorySlot(hotbarFirst = true)
- window.countRange (start, end, itemType, metadata)
- window.itemsRange (start, end)
- window.count(itemType, [metadata])
- window.items()
- window.containerCount(itemType, [metadata])
- window.containerItems()
- window.emptySlotCount()
- window.transactionRequiresConfirmation(click)
- Events
Create a window with:
id
- the window idtype
- this can be a string or a numeric id depending on the mcVersiontitle
- the title of the windowslotCount
- used to set the number of slots for mcVersion prior to 1.14, ignored in 1.14
The protocol id of the window
Type of the window, can be a string or a numeric id depending on the mcVersion
Title of the window, shown in the gui.
Map of slot index to Item
instance. null
if the slot is empty.
Slot from where the player inventory start in the window.
Slot from where the player inventory end in the window.
Slot from where the player hotbar start in the window.
Slot for the crafting result if this window has one, -1
otherwise.
boolean
only false for chests in pre-1.14 versions.
In vanilla client, this is the item you are holding with the mouse cursor.
Change the slot
to contain the newItem
. Emit the updateSlot
events.
Returns a list of changed slots mirroring the Window Click packet format
Change the slot
to contain the newItem
. Emit the updateSlot
events.
start
- start slot to begin the search fromend
- end slot to end the searchitem
- numerical id that you are looking for check the listmetadata
- metadata value that you are looking for.null
means unspecified.notFull
- (optional) - iftrue
, means that the returned item should not be at itsstackSize
.nbt
- nbt data for the item you are looking for.null
means unspecified
start
- start slot to begin the search fromend
- end slot to end the searchitem
- name that you are looking for check the listmetadata
- metadata value that you are looking for.null
means unspecified.notFull
- (optional) - iftrue
, means that the returned item should not be at itsstackSize
.
Search in the player inventory.
item
- numerical id or name that you are looking for check the listmetadata
- metadata value that you are looking for.null
means unspecified.notFull
- (optional) - iftrue
, means that the returned item should not be at itsstackSize
.
Search in the container of the window.
item
- numerical id or name that you are looking for check the listmetadata
- metadata value that you are looking for.null
means unspecified.notFull
- (optional) - iftrue
, means that the returned item should not be at itsstackSize
.
Return the id of the first empty slot between start
and end
.
Return the id of the first empty slot in the hotbar.
Return the id of the first empty slot in the container.
Return the id of the first empty slot in the inventory, start looking in the hotbar first if the flag is set.
Returns how many item you have of the given type, between slots start
and end
.
itemType
- numerical id that you are looking formetadata
- (optional) metadata value that you are looking for. defaults to unspecified
Returns a list of Item
instances between slots start
and end
.
Returns how many you have in the inventory section of the window.
itemType
- numerical id that you are looking formetadata
- (optional) metadata value that you are looking for. defaults to unspecified
Returns a list of Item
instances from the inventory section of the window.
Returns how many you have in the top section of the window.
itemType
- numerical id that you are looking formetadata
- (optional) metadata value that you are looking for. defaults to unspecified
Returns a list of Item
instances from the top section of the window.
Returns how many empty slots you have in the inventory section of the window.
Returns the property: requiresConfirmation
.
Sets all slots in the window to null (unless specified by args)
blockId
- (optional) numerical id of the block that you would like to clearcount
- (optional, requires blockId) only delete this number of the given block
Fired whenever any slot in the window changes for any reason.
Watching bot.inventory.on("updateSlot")
is the best way to watch for changes in your inventory.
slot
- index of changed slot.oldItem
,newItem
- either anItem
instance ornull
.
newItem === window.slots[slot]
.
Fired whenever a specific slot in the window changes for any reason.
oldItem
,newItem
- either anItem
instance ornull
.
newItem === window.slots[slot]
.