PlayerInventory
com.jsmacrosce.jsmacros.client.api.classes.inventory.PlayerInventory
The player's inventory screen, including its crafting result, input grid, equipment, and hotbar.
js
const inv = Player.openInventory();
if (inv instanceof Inventories.Player) {
Chat.log(`${inv.getOutput().getItemId()} in the crafting result, `
+ `${inv.getOffhand().getItemId()} in the offhand`);
}Available in scripts as Inventories.Player.
Methods
getBoots
Returns: the item in the boots slot
getChestplate
Returns: the item in the chestplate slot
getCraftingHeight
Returns 0; this value does not describe the player's 2-by-2 crafting grid. Use getInput(int, int) to read its cells.
Returns: int
getCraftingSlotCount
Returns 0 despite the four crafting cells; getInput() therefore returns an empty grid.
Returns: int
getCraftingWidth
Returns 0; this value does not describe the player's 2-by-2 crafting grid. Use getInput(int, int) to read its cells.
Returns: int
getHelmet
Returns: the item in the helmet slot
getInput
Returns the item in the player's 2-by-2 crafting grid. Coordinates are zero-based, with
x increasing left to right and y top to bottom.Parameters:
x: column in the grid, from 0 to 1y: row in the grid, from 0 to 1
Returns: the item in the selected grid slot
Returns input cells in an array indexed by column, then row. Its dimensions are the reported width and height, so it is empty when either dimension is zero.
Returns: the grid as
[column][row]getLeggings
Returns: the item in the leggings slot
getOffhand
Returns: the item in menu slot 45 (the offhand)
getOutput
Returns the item currently in the player's crafting result slot. Read the 2-by-2 input grid with getInput(int, int); the crafting dimensions reported by this class are zero.
Returns: the current crafting result
isInHotbar
Checks whether a player-inventory menu slot is in the hotbar or offhand.
Parameters:
slot: menu slot index
Returns:
true for hotbar slots 36 through 44 or offhand slot 45; false otherwise