public class VillagerTradesEvent
extends net.minecraftforge.eventbus.api.Event
FMLServerAboutToStartEvent
. 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.func_221128_d(int)
which is called before attempting to level up.
To add trades to the merchant, simply add new trades to the list. BasicTrade
provides a default implementation.Modifier and Type | Field and Description |
---|---|
protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> |
trades |
protected VillagerProfession |
type |
Constructor and Description |
---|
VillagerTradesEvent(it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> trades,
VillagerProfession type) |
Modifier and Type | Method and Description |
---|---|
it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> |
getTrades() |
VillagerProfession |
getType() |
protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> trades
protected VillagerProfession type
public VillagerTradesEvent(it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> trades, VillagerProfession type)
public it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> getTrades()
public VillagerProfession getType()