Play Strawberry Docs
Referencia

Esta página se muestra en inglés.

item-stack

Item-stack resources and typed item data operations.

Declarations from the script contract strawberry:plugin, version 0.2.0, without source comments.

WIT declarations

text
use attributes.{attribute, attribute-modifier};
use data-components.{data-component};
use enchantments.{attribute-modifier-slot, enchantment};
use text.{text-component};

record enchantment-value {
    enchantment: enchantment,
    level: u32,
}

record custom-enchantment-value {
    enchantment-id: string,
    level: u32,
}

record item-attribute-modifier {
    attribute: attribute,
    modifier: attribute-modifier,
    slot: attribute-modifier-slot,
}

enum equippable-slot {
    main-hand,
    off-hand,
    feet,
    legs,
    chest,
    head,
    body,
    saddle,
}

record equippable {
    slot: equippable-slot,
    asset-id: option<string>,
    camera-overlay: option<string>,
    dispensable: bool,
    swappable: bool,
    damage-on-hurt: bool,
    equip-on-interact: bool,
    can-be-sheared: bool,
}

record data-component-value {
    component: data-component,
    value: list<u8>,
}

use common.{nbt-entry, nbt-tree, nbt-tag, block-pos};

record lodestone-target {
    world-key: string,
    pos: block-pos,
    tracked: bool,
}

resource item-stack {
    constructor(registry-key: string, count: u8);
    get-registry-key: func() -> string;
    get-count: func() -> u8;
    set-count: func(count: u8);
    get-max-count: func() -> u8;
    get-enchantments: func() -> list<enchantment-value>;
    add-enchantment: func(enchantment: enchantment, level: u32);
    remove-enchantment: func(enchantment: enchantment);
    get-custom-enchantments: func() -> list<custom-enchantment-value>;
    add-custom-enchantment: func(enchantment-id: string, level: u32);
    remove-custom-enchantment: func(enchantment-id: string);
    get-custom-enchantment-level: func(enchantment-id: string) -> option<u32>;
    has-custom-enchantment: func(enchantment-id: string) -> bool;
    get-attribute-modifiers: func() -> list<item-attribute-modifier>;
    add-attribute-modifier: func(modifier: item-attribute-modifier);
    remove-attribute-modifiers: func(attribute: attribute);
    clear-attribute-modifiers: func();
    get-lore: func() -> list<text-component>;
    set-lore: func(lore: list<text-component>);
    add-lore: func(line: text-component);
    get-custom-name: func() -> option<text-component>;
    set-custom-name: func(name: option<text-component>);
    set-custom-data: func(namespace: string, key: string, value: nbt-tree);
    get-custom-data: func(namespace: string, key: string) -> option<nbt-tree>;
    remove-custom-data: func(namespace: string, key: string);
    has-custom-data: func(namespace: string, key: string) -> bool;
    get-components: func() -> list<data-component-value>;
    set-component: func(component: data-component, value: list<u8>);
    try-set-component: func(component: data-component, value: list<u8>) -> result<_, string>;
    set-equippable: func(equippable: equippable) -> result<_, string>;
    set-dyed-color: func(rgb: u32);
    set-unbreakable: func();
    set-glint-override: func(glint: bool);
    set-tooltip-display: func(hide-tooltip: bool, hidden: list<data-component>);
    get-lodestone-target: func() -> option<lodestone-target>;
    set-lodestone-target: func(target: option<lodestone-target>) -> result<_, string>;
    remove-component: func(component: data-component);
}

En esta página