60 lines
2.2 KiB
Plaintext
60 lines
2.2 KiB
Plaintext
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<u8>,
|
|
}
|
|
|
|
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<enchantment-value>;
|
|
/// 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<text-component>;
|
|
/// Sets the lore of this item stack.
|
|
set-lore: func(lore: list<text-component>);
|
|
/// 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<text-component>;
|
|
/// Sets the custom name of this item stack.
|
|
set-custom-name: func(name: option<text-component>);
|
|
|
|
/// Returns all data components on this item stack.
|
|
get-components: func() -> list<data-component-value>;
|
|
/// Sets a data component on this item stack.
|
|
set-component: func(component: data-component, value: list<u8>);
|
|
/// Removes a data component from this item stack.
|
|
remove-component: func(component: data-component);
|
|
}
|
|
}
|