Skip to content

CraftingInventory ​

com.jsmacrosce.jsmacros.client.api.classes.inventory.CraftingInventory

Since1.8.4

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 ​

getCraftingHeight(): intSince1.8.4#
Returns: the crafting menu's grid height

getCraftingSlotCount ​

getCraftingSlotCount(): intSince1.8.4#
Returns: the number of input slots in the grid, excluding the result slot and player inventory

getCraftingWidth ​

getCraftingWidth(): intSince1.8.4#
Returns: the crafting menu's grid width

getInput ​

getInput(int x, int y): ItemStackHelperSince1.8.4#
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
getInput(): ItemStackHelper[][]Since1.8.4#
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 ​

getOutput(): ItemStackHelperSince1.8.4#
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

toString ​

toString(): String#
Returns the fixed diagnostic label CraftingInventory:{}.
Returns: the fixed diagnostic label CraftingInventory:{}