prismarine-windows (master) doxdox documentation

Represent minecraft windows

# 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.

# emptySlotCount()

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

# 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)

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

# 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

# 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.

# slots()

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

# title()

Title of the window, shown in the gui

# transactionRequiresConfirmation(click)

Returns the property: requiresConfirmation

Parameters

Name Types Description
click

# 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}