TradeEntry record
Represents a trade entry offered by a villager or wandering trader.
public sealed record TradeEntry : INetworkSerializable<TradeEntry>, IEquatable<TradeEntry>
In Obsidian.API.
Constructors
public TradeEntry();Properties
Demand
public int Demand { get; set; }Used in calculating the final price. Negative values are treated as zero.
Discount
public int Discount { get; set; }Used in calculating the final price. Can be zero or negative.
FirstInput
public TradeItem FirstInput { get; set; }The first input item of the trade. The required count of the first input is the "base price" of the trade. The final price = base + floor(base * TradeEntry.Multiplier * TradeEntry.Demand) + TradeEntry.Discount.
IsDisabled
public bool IsDisabled { get; set; }Whether the trade is disabled.
MaxCount
public int MaxCount { get; set; }The maximum number of times the trade can be used before it becomes disabled.
Multiplier
public float Multiplier { get; set; }Used in calculating the final price. Can be low (0.05) or high (0.2).
Output
public ItemStack Output { get; set; }The output item of the trade.
RewardExp
public bool RewardExp { get; set; }Whether completing this offer rewards the player with experience orbs.
SecondInput
public TradeItem SecondInput { get; set; }The second input item of the trade. The required count of the second input is not affected by discount or demand.
UsedCount
public int UsedCount { get; set; }Number of times the trade has been used.
XP
public int XP { get; set; }Number of XPs the villager will earn after each trade.
Methods
public static TradeEntry Read(INetStreamReader reader);public static void Write(TradeEntry value, INetStreamWriter writer);