interface item-stack { use data-components.{data-component}; use enchantments.{enchantment}; use text.{text-component}; /// Represents an enchantment and its level. record enchantment-value { enchantment: enchantment, level: u32, } /// Represents a data component and its serialized value. record data-component-value { component: data-component, /// The serialized value of the component. value: list, } /// Represents one entry in an NBT compound tag. record nbt-entry { key: string, value: u32, } /// Represents a Minecraft NBT tag tree. record nbt-tree { root: u32, tags: list, } /// Represents a Minecraft NBT tag. variant nbt-tag { byte(s8), short(s16), int(s32), long(s64), float(f32), double(f64), byte-array(list), string-tag(string), list-tag(list), compound(list), int-array(list), long-array(list), } resource item-stack { constructor(registry-key: string, count: u8); /// Returns the unique registry key of the item (e.g., "minecraft:diamond"). get-registry-key: func() -> string; /// Returns the number of items in the stack. get-count: func() -> u8; /// Sets the number of items in the stack. set-count: func(count: u8); /// Returns the maximum number of items that can be in this stack. get-max-count: func() -> u8; /// Returns all enchantments on this item stack. get-enchantments: func() -> list; /// Adds an enchantment to this item stack. add-enchantment: func(enchantment: enchantment, level: u32); /// Removes an enchantment from this item stack. remove-enchantment: func(enchantment: enchantment); /// Returns the lore of this item stack. get-lore: func() -> list; /// Sets the lore of this item stack. set-lore: func(lore: list); /// Adds a line to the lore of this item stack. add-lore: func(line: text-component); /// Returns the custom name of this item stack, if set. get-custom-name: func() -> option; /// Sets the custom name of this item stack. set-custom-name: func(name: option); /// Sets a namespaced custom data value on this item stack. set-custom-data: func(namespace: string, key: string, value: nbt-tree); /// Returns a namespaced custom data value from this item stack, if set. get-custom-data: func(namespace: string, key: string) -> option; /// Removes a namespaced custom data value from this item stack. remove-custom-data: func(namespace: string, key: string); /// Returns whether this item stack has a namespaced custom data value. has-custom-data: func(namespace: string, key: string) -> bool; /// Returns all data components on this item stack. get-components: func() -> list; /// Sets a data component on this item stack. set-component: func(component: data-component, value: list); /// Removes a data component from this item stack. remove-component: func(component: data-component); } }