InventoryBlock API
InventoryBlock is a typed wrapper for blocks that own an inventory.
Reference
getInventoryName()Returns the inventory’s custom label as aString.getItems()ReturnsItemStack[]for all stored stacks, ornilwhen the inventory is empty.getInventoryVolume()Returns the current volume used by stored items as aDouble.hasItems()Returnstruewhen at least one item stack is present.addItems(itemStacks)Adds requested stacks into the block inventory.removeItems(itemStacks)Removes requested stacks from the block inventory when enough items are present.transferItemsTo(targetInventory, itemStacks)Moves requested stacks from this block inventory intotargetInventory.transferItemsFrom(sourceInventory, itemStacks)Pulls requested stacks fromsourceInventoryinto this block inventory.clearItems()Removes all items from the block inventory.
Notes
Obtain this wrapper via
peripheral.wrap(block, "inventory").