Referencia
Esta página se muestra en inglés.
inventory
Inventory and player-inventory resources and slot operations.
Declarations from the script contract strawberry:plugin, version 0.2.0, without source comments.
WIT declarations
use item-stack.{item-stack};
use common.{hand};
resource inventory {
get-size: func() -> u32;
get-id: func() -> option<u64>;
is-empty: func() -> bool;
get-item: func(slot: u32) -> option<item-stack>;
set-item: func(slot: u32, item: option<item-stack>);
replace-item: func(slot: u32, expected: option<borrow<item-stack>>, item: option<item-stack>) -> result<_, option<item-stack>>;
add-item: func(stack: item-stack) -> option<item-stack>;
remove-item: func(slot: u32) -> option<item-stack>;
clear: func();
get-all-items: func() -> list<option<item-stack>>;
set-all-items: func(items: list<option<item-stack>>);
count-item: func(item-id: string) -> u32;
contains-item: func(item-id: string) -> bool;
}
resource player-inventory {
as-inventory: func() -> inventory;
get-item-in-hand: func(hand: hand) -> option<item-stack>;
set-item-in-hand: func(hand: hand, item: option<item-stack>);
get-selected-slot: func() -> u8;
set-selected-slot: func(slot: u8);
get-helmet: func() -> option<item-stack>;
set-helmet: func(item: option<item-stack>);
get-chestplate: func() -> option<item-stack>;
set-chestplate: func(item: option<item-stack>);
get-leggings: func() -> option<item-stack>;
set-leggings: func(item: option<item-stack>);
get-boots: func() -> option<item-stack>;
set-boots: func(item: option<item-stack>);
get-off-hand: func() -> option<item-stack>;
set-off-hand: func(item: option<item-stack>);
clear-armor: func();
clear-main: func();
clear-all: func();
}