CraftingInventory
com.jsmacrosce.jsmacros.client.api.classes.inventory.CraftingInventory
Provides access to the input grid and result of a crafting menu.
js
const inv = Player.openInventory();
if (inv instanceof Inventories.Crafting) {
const cell = inv.getInput(0, 0);
Chat.log(cell.isEmpty() ? "empty top-left cell" : cell.getItemId());
}Available in scripts as Inventories.Crafting.
Methods
getCraftingHeight
Returns: the crafting menu's grid height
getCraftingSlotCount
Returns: the number of input slots in the grid, excluding the result slot and player inventory
getCraftingWidth
Returns: the crafting menu's grid width
getInput
Returns the input cell at the given column and row in the 3 by 3 grid.
Parameters:
x: column, from 0 (left) to 2 (right)y: row, from 0 (top) to 2 (bottom)
Returns: the item in that input 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]getOutput
Returns the current contents of the crafting menu's result slot; it does not calculate a result independently.
Returns: the item in the result slot