Skip to content

CreativeInventory ​

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

Since1.8.4

Handles the creative inventory screen and its item tabs.

js
const inv = Player.openInventory();  
if (inv instanceof Inventories.Creative) {
 Chat.log(`${inv.getShownItems().size()} items on the selected tab`);  
}

Available in scripts as Inventories.Creative.

Methods ​

destroyAllItems ​

destroyAllItems(): CreativeInventorySince1.8.4#
Clears every slot in this inventory menu by sending an empty stack for each slot through the creative item-add operation.
Returns: self for chaining.

destroyHeldItem ​

destroyHeldItem(): CreativeInventorySince1.8.4#
Clears the item stack carried by the creative inventory menu.
Returns: self for chaining.

getBoots ​

getBoots(): ItemStackHelperSince1.8.4#
Returns: the item in creative-menu slot 36

getChestplate ​

getChestplate(): ItemStackHelperSince1.8.4#
Returns: the item in creative-menu slot 38

getHelmet ​

getHelmet(): ItemStackHelperSince1.8.4#
Returns: the item in creative-menu slot 39

getLeggings ​

getLeggings(): ItemStackHelperSince1.8.4#
Returns: the item in creative-menu slot 37

getOffhand ​

getOffhand(): ItemStackHelperSince1.8.4#
Returns: the item in creative-menu slot 40

getSavedHotbar ​

getSavedHotbar(int index): List<ItemStackHelper>Since1.8.4#
Returns the item stacks stored in a saved hotbar.

Parameters:

  • index: saved-hotbar index, from 0 to 8
Returns: the saved hotbar's item stacks

getShownItems ​

getShownItems(): List<ItemStackHelper>Since1.8.4#
Returns: the items currently displayed in the creative item list.

getTabNames ​

getTabNames(): List<String>Since1.8.4#
Returns the current localized display name of each creative tab, in CreativeModeTabs.allTabs() order. These names are not tab IDs and are the values matched by selectTab(String).
Returns: the tab display names

getTabTexts ​

getTabTexts(): List<TextHelper>Since1.8.4#
Returns each creative tab's current localized display name as a text object, in the same order as getTabNames().
Returns: the tab display names as text objects

isInHotbar ​

isInHotbar(int slot): booleanSince1.8.4#
Tests whether a menu slot is one of the player's nine hotbar slots or the offhand slot.

Parameters:

  • slot: menu slot index
Returns: true for hotbar slots 36..44 or offhand slot 45; false otherwise

restoreHotbar ​

restoreHotbar(int index): CreativeInventorySince1.8.4#
Restores a saved hotbar to the player's current hotbar.

Parameters:

  • index: saved-hotbar index, from 0 to 8
Returns: self for chaining.

saveHotbar ​

saveHotbar(int index): CreativeInventorySince1.8.4#
Saves the player's current hotbar to a saved-hotbar slot.

Parameters:

  • index: saved-hotbar index, from 0 to 8
Returns: self for chaining.

scroll ​

scroll(double amount): CreativeInventorySince1.8.4#
Scrolls the creative item list by a relative amount when it has a scrollbar.

Parameters:

  • amount: relative change to the current scroll position; the resulting position is clamped to 0..1
Returns: self for chaining.

scrollTo ​

scrollTo(double position): CreativeInventorySince1.8.4#
Sets the creative item list's scroll position when it has a scrollbar; otherwise, does nothing.

Parameters:

  • position: scroll position, clamped to 0..1
Returns: self for chaining.

search ​

search(String search): CreativeInventorySince1.8.4#
Sets the search text and refreshes results only while the search tab is selected. Otherwise, it does nothing.

Parameters:

  • search: text to search for
Returns: self for chaining.

selectHotbar ​

selectHotbar(): CreativeInventorySince1.8.4#
Selects the hotbar tab asynchronously on the client executor.
Returns: self for chaining.

selectInventory ​

selectInventory(): CreativeInventorySince1.8.4#
Selects the inventory tab asynchronously on the client executor.
Returns: self for chaining.

selectSearch ​

selectSearch(): CreativeInventorySince1.8.4#
Selects the search tab asynchronously on the client executor.
Returns: self for chaining.

selectTab ​

selectTab(String tabName): CreativeInventorySince1.8.4#
Selects the tab whose current display name exactly matches the argument. The selection is scheduled on the client executor; comparison uses the localized display name.

Parameters:

  • tabName: the display name of the tab to select
Returns: self for chaining.

setCursorStack ​

setCursorStack(ItemStackHelper stack): CreativeInventorySince1.8.4#
Sets the stack carried by the creative inventory menu.

Parameters:

  • stack: the stack to carry
Returns: self for chaining.

setStack ​

setStack(int slot, ItemStackHelper stack): CreativeInventorySince1.8.4#
Sets a slot through the creative item-add operation.

Parameters:

  • slot: the menu slot to set
  • stack: the stack to set
Returns: self for chaining.

toString ​

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