Play Strawberry Docs
Reference

merchant

Trading windows of your own, and the offers of a villager or a wandering trader.

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

WIT declarations

text
use item-stack.{item-stack};
use text.{text-component};
use player.{player};
use %world.{entity};

record merchant-offer {
    first-cost: item-stack,
    second-cost: option<item-stack>,
    %result: item-stack,
    uses: u32,
    max-uses: u32,
    reward-experience: bool,
    villager-experience: u32,
    price-multiplier: f32,
    demand: s32,
    special-price: s32,
}

enum merchant-error {
    too-many-offers,
    invalid-offer,
    not-a-merchant,
    trading,
    not-opened,
}

open-merchant: func(viewer: borrow<player>, title: text-component, offers: list<merchant-offer>) -> result<u32, merchant-error>;
offers: func(merchant: borrow<entity>) -> option<list<merchant-offer>>;
trading-player: func(merchant: borrow<entity>) -> option<player>;
set-offers: func(merchant: borrow<entity>, offers: list<merchant-offer>) -> result<_, merchant-error>;

On this page