Skip to content

LoomInventory ​

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

Since1.5.1

Provides access to pattern selection in an open loom screen. Available patterns are determined by the pattern slot; selecting one requires the pattern list to be displayed.

js
const inv = Player.openInventory();  
if (inv instanceof Inventories.Loom) {
  const patterns = inv.listAvailablePatterns();  
  Chat.log(`${patterns.size()} patterns on offer`);  
  if (patterns.size() > 0) {
    Chat.log(`picking ${patterns.get(0)}`);  
    inv.selectPattern(0);  
  }
}

Available in scripts as Inventories.Loom.

Methods ​

listAvailablePatterns ​

listAvailablePatterns(): List<String>Since1.7.0#
Returns the registry ids of patterns available for the current pattern-slot item, in selection order. An empty pattern slot yields patterns that need no item; an item with no provided patterns yields an empty list. The banner and dye do not affect this list.
Returns: the available pattern registry ids, in the order the loom offers them

selectPattern ​

selectPattern(int index): booleanSince1.5.1#
Selects a currently available pattern by its zero-based position and sends the selection to the server. Returns false for an out-of-range index or when the pattern list is not displayed.

Parameters:

  • index: zero-based position in the available pattern list
Returns: true if the pattern was selected and the loom was asked to apply it, false otherwise

selectPatternId ​

selectPatternId(String id): booleanSince1.5.1#
Selects a currently available pattern by its registry id and sends the selection to the server. Returns false if the id is unavailable or the pattern list is not displayed.

Parameters:

  • id: the registry id of the pattern to apply, such as "minecraft:base"
Returns: true if the pattern was selected and the loom was asked to apply it, false otherwise

toString ​

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