Class in @minecraft/server
Extends ItemComponent
The slots inside an item: a shulker box’s 27.
import { ItemInventoryComponent } from '@minecraft/server';Example
Section titled “Example”import { ItemStack, type ItemInventoryComponent } from '@minecraft/server';
const item = new ItemStack('minecraft:diamond_sword');const component: ItemInventoryComponent | undefined = item.getComponent('minecraft:inventory');if (component) { console.log(item.typeId, component.typeId);}import { ItemStack } from '@minecraft/server';
const item = new ItemStack('minecraft:diamond_sword');const component = item.getComponent('minecraft:inventory');if (component) { console.log(item.typeId, component.typeId);}Properties
Section titled “Properties”componentId
Section titled “componentId”static read-only
static readonly componentId = "minecraft:inventory";container
Section titled “container”read-only
readonly container: Container;Read only in Basalt: changing a slot throws.
Types
Used by
Section titled “Used by”ItemComponentTypeMap.inventory, ItemComponentTypeMap.minecraft:inventory
Inherited
Section titled “Inherited”From ItemComponent: typeId, isValid