类 VillagerTradesEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.village.VillagerTradesEvent
public class VillagerTradesEvent
extends net.minecraftforge.eventbus.api.Event
VillagerTradesEvent is fired during the
provides a default implementation.
ServerAboutToStartEvent
. It is used to gather the trade lists for each profession.
It is fired on the MinecraftForge.EVENT_BUS
.
It is fired once for each registered villager profession.
Villagers pick two trades from their trade map, based on their level.
Villager level is increased by successful trades.
The map is populated for levels 1-5 (inclusive), so Map#get will never return null for those keys.
Levels outside of this range do nothing, as specified by VillagerData.canLevelUp(int)
which is called before attempting to level up.
To add trades to the merchant, simply add new trades to the list.
引用无效
BasicItemListing
-
嵌套类概要
从类继承的嵌套类/接口 net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
字段概要
字段修饰符和类型字段说明protected it.unimi.dsi.fastutil.ints.Int2ObjectMap
<List<VillagerTrades.ItemListing>> protected VillagerProfession
-
构造器概要
构造器构造器说明VillagerTradesEvent
(it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<VillagerTrades.ItemListing>> trades, VillagerProfession type) -
方法概要
从类继承的方法 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
字段详细资料
-
trades
-
type
-
-
构造器详细资料
-
VillagerTradesEvent
public VillagerTradesEvent(it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<VillagerTrades.ItemListing>> trades, VillagerProfession type)
-
-
方法详细资料
-
getTrades
-
getType
-