prismarine-windows (master) doxdox documentation

Represent minecraft windows

# acceptClick(click, gamemode)

accepts Clicks of with any mode, mouseButton and slot

Parameters

Name Types Description
click click object to accept
gamemode to know when certain clicks are allowed

# acceptCraftingClick()

# acceptInventoryClick()

# acceptNonInventorySwapAreaClick()

# acceptOutsideWindowClick()

# acceptSwapAreaLeftClick()

# acceptSwapAreaRightClick()

# clear(blockId, count)

Sets all slots in the window to null (unless specified by args)

Parameters

Name Types Description
blockId (optional) numerical id of the block that you would like to clear
count (optional, requires blockId) only delete this number of the given block

# containerCount(itemType, metadata)

Returns how many you have in the top section of the window

Parameters

Name Types Description
itemType numerical id that you are looking for
metadata (optional) metadata value that you are looking for. defaults to unspecified

# containerItems()

Returns a list of Item instances from the top section of the window

# count(itemType, metadata)

Returns how many you have in the inventory section of the window

Parameters

Name Types Description
itemType numerical id that you are looking for
metadata (optional) metadata value that you are looking for. defaults to unspecified

# countRange(start, end, itemType, metadata)

Returns how many item you have of the given type, between slots start and end

Parameters

Name Types Description
start
end
itemType numerical id that you are looking for
metadata (optional) metadata value that you are looking for. defaults to unspecified

# craftingResultSlot()

Slot for the crafting result if this window has one, -1 otherwise.

# dropClick()

Accepts click mode 4 with mouseButton 0 (drops one of the item) or 1 (drops all of the item)

# dropSelectedItem(untilEmpty)

Drops item held in mouse cursor

Parameters

Name Types Description
untilEmpty if true whole item stack will be dropped (else just one)

# emptySlotCount()

Returns how many empty slots you have in the inventory section of the window

# fillSlotWithItem(itemToFill, itemToTake)

Fills slot with specified item

Parameters

Name Types Description
itemToFill item of which the count should be increased
itemToTake item of which the count should be decreased

# fillSlotWithSelectedItem(item, untilFull)

Fills slot with selectedItem (the item held in mouse cursor)

Parameters

Name Types Description
item item of which the count should be increased
untilFull if true as many as possible will be transfered

# findContainerItem(itemType, metadata, notFull)

Search in the container of the window

Parameters

Name Types Description
itemType numerical id or name that you are looking for
metadata metadata value that you are looking for. null means unspecified
notFull (optional) - if true, means that the returned item should not be at its stackSize

# findInventoryItem(itemType, metadata, notFull)

Search in the player inventory

Parameters

Name Types Description
itemType numerical id or name that you are looking for
metadata metadata value that you are looking for. null means unspecified
notFull (optional) - if true, means that the returned item should not be at its stackSize

# findItemRange(start, end, itemType, metadata, notFull, nbt)

Returns item in the given range matching the one specified

Parameters

Name Types Description
start start slot to begin the search from
end end slot to end the search
itemType numerical id that you are looking for
metadata metadata value that you are looking for. null means unspecified
notFull (optional) - if true, means that the returned item should not be at its stackSize
nbt nbt data for the item you are looking for. null means unspecified

# findItemRangeName(start, end, itemName, metadata, notFull)

Parameters

Name Types Description
start start slot to begin the search from
end end slot to end the search
itemName name that you are looking for
metadata metadata value that you are looking for. null means unspecified
notFull (optional) - if true, means that the returned item should not be at its stackSize

# findItemsRange(start, end, itemType, metadata, notFull, nbt)

Returns array of items in the given range matching the one specified

Parameters

Name Types Description
start start slot to begin the search from
end end slot to end the search
itemType numerical id that you are looking for
metadata metadata value that you are looking for. null means unspecified
notFull (optional) - if true, means that the returned item should not be at its stackSize
nbt nbt data for the item you are looking for. null means unspecified

# firstEmptyContainerSlot()

Return the id of the first empty slot in the container

# firstEmptyHotbarSlot()

Return the id of the first empty slot in the hotbar

# firstEmptyInventorySlot(hotbarFirst)

Return the id of the first empty slot in the inventory, start looking in the hotbar first if the flag is set

Parameters

Name Types Description
hotbarFirst DEFAULT: true

# firstEmptySlotRange(start, end)

Return the id of the first empty slot between start and end

Parameters

Name Types Description
start
end

# hotbarStart()

Slot from where the player hotbar start in the window.

# id()

The protocol id of the window

# inventoryEnd()

Slot from where the player inventory end in the window

# inventoryStart()

Slot from where the player inventory start in the window

# items()

Returns a list of Item instances from the inventory section of the window

# itemsRange(start, end)

Returns a list of Item instances between slots start and end

Parameters

Name Types Description
start
end

# middleClick()

Accepts click mode 3 with mouseButton 2 (gets a stack of the item at the slot into the selectedItem)

# mouseClick()

Accepts click mode 0 with mouseButton 0 or 1

# numberClick()

Accepts click mode 2 with mouseButton 0 (hotbarStart) to 8 (hotbarEnd) representing the hotbar slots

# requiresConfirmation()

Boolean only false for chests in pre-1.14 versions.

# selectedItem()

In vanilla client, this is the item you are holding with the mouse cursor.

# shiftClick()

Accepts click mode 1 with mouseButton 0 or 1 (identical behaviour)

# slots()

Map of slot index to Item instance. null if the slot is empty

# splitSlot(item)

Splits the slot in half and holds the split in mouse cursor

Parameters

Name Types Description
item item to split

# sumRange(start, end)

Returns how much items there are ignoring what the item is, between slots start and end

Parameters

Name Types Description
start
end

# swapSelectedItem(item)

Swaps item with the item in mouse cursor

Parameters

Name Types Description
item item to swap with

# title()

Title of the window, shown in the gui

# transactionRequiresConfirmation(click)

Returns the property: requiresConfirmation

Parameters

Name Types Description
click

# tToFirst(item, start, end, lastToFirst)

Fills within specified range with given item and dumps remaining items if present and possible

Parameters

Name Types Description
item item used to fill slots
start start slot to begin the search from
end end slot to end the search
lastToFirst if true the matching Slots will be filled from the back

# tToFirst(slots, lastToFirst)

Fills slots with specified item

Parameters

Name Types Description
slots slots to fill with the item
lastToFirst if true the matching Slots will be filled from the back

# tToFirst(item, start, end, lastToFirst)

Searches for empty slot to dump the specified item

Parameters

Name Types Description
item item which should be dumped
start start slot to begin the search from
end end slot to end the search
lastToFirst if true item slot will be searched from the back

# type()

Type of the window, can be a string or a numeric id depending on the mcVersion

# updateSlot(slot, newItem)

Change the slot to contain the newItem. Emit the updateSlot events.

Parameters

Name Types Description
slot {number}
newItem {Item}