StoneCutterInventory
com.jsmacrosce.jsmacros.client.api.classes.inventory.StoneCutterInventory
Handles an open stonecutter screen. Recipe indices in getRecipes() correspond to those accepted by selectRecipe(int).
js
const inv = Player.openInventory();
if (inv instanceof Inventories.StoneCutter) {
if (inv.canCraft()) {
const count = inv.getAvailableRecipeCount();
Chat.log(`${count} cuts from ${inv.getSlot(0).getItemId()}`);
inv.selectRecipe(0);
Chat.log(`now making ${inv.getOutput().getItemId()}`);
}
}Available in scripts as Inventories.StoneCutter.
Constructors
new StoneCutterInventory
new StoneCutterInventory(StonecutterScreen inventory)#Wraps the supplied stonecutter screen and captures its menu and current client player state. Obtain the current inventory wrapper with FPlayer.openInventory().
Parameters:
inventory: the stonecutter screen to wrap
Methods
canCraft
Returns whether the menu has an input item.
Returns:
true if the menu has an input item; false otherwisegetAvailableRecipeCount
Returns the number of currently visible recipes.
Returns: the number of currently visible recipes
getOutput
Returns the stonecutter result slot (slot 1).
Returns: the result slot
getRecipes
Returns displayed results for the currently visible recipes, in selection-index order.
Returns: displayed results in selection-index order
getSelectedRecipeIndex
Returns the selected recipe index, or
-1 when no recipe is selected.Returns: the selected recipe index, or
-1 when none is selectedselectRecipe
Selects a currently visible recipe by its zero-based index. Indices outside the visible range do nothing.
Parameters:
idx: zero-based recipe index
Returns: this inventory for chaining, regardless of whether selection occurred