接口 Merchant
- 所有已知子接口:
AbstractVillager
,Villager
,WanderingTrader
public interface Merchant
代表一个商人.商人是一种特殊类型的库存,是一种以物换物的自定义交易.
Represents a merchant. A merchant is a special type of inventory which can facilitate custom trades between items.
-
方法概要
修饰符和类型方法说明getRecipe
(int i) 获取该商人的交易列表的某个索引处的MerchantRecipe
.int
获取此商人当前可用的交易数量.获取该商人当前可用的交易列表.获取该商人正在进行交易的玩家, 如果目前没有交易,则返回null.boolean
获取该商人是否正在交易.void
setRecipe
(int i, @NotNull MerchantRecipe recipe) 设置在该商人的交易列表的指定索引处的MerchantRecipe
.void
setRecipes
(@NotNull List<MerchantRecipe> recipes) 设置该商家当前可用的交易列表.
-
方法详细资料
-
getRecipes
获取该商人当前可用的交易列表.原文: Get a list of trades currently available from this merchant.
- 返回:
- 一个不可变的交易列表
-
setRecipes
设置该商家当前可用的交易列表.
这不会改变当前与该商家交易的玩家的选定交易.原文: Set the list of trades currently available from this merchant.
This will not change the selected trades of players currently trading with this merchant.- 参数:
recipes
- 一个关于MerchantRecipe
的List
-
getRecipe
获取该商人的交易列表的某个索引处的MerchantRecipe
.原文: Get the recipe at a certain index of this merchant's trade list.
- 参数:
i
- 索引- 返回:
MerchantRecipe
- 抛出:
IndexOutOfBoundsException
- 当索引越界时抛出此异常
-
setRecipe
设置在该商人的交易列表的指定索引处的MerchantRecipe
.原文: Set the recipe at a certain index of this merchant's trade list.
- 参数:
i
- 索引recipe
- 给定的交易配方- 抛出:
IndexOutOfBoundsException
- 当索引越界时抛出此异常
-
getRecipeCount
int getRecipeCount()获取此商人当前可用的交易数量.原文: Get the number of trades this merchant currently has available.
- 返回:
- the recipe count
-
isTrading
boolean isTrading()获取该商人是否正在交易.原文: Gets whether this merchant is currently trading.
- 返回:
- 商人是否在交易
-
getTrader
获取该商人正在进行交易的玩家, 如果目前没有交易,则返回null.原文: Gets the player this merchant is trading with, or null if it is not currently trading.
- 返回:
- 与商人正在交易的玩家, 当没有交易的时候返回null
-