Package net.minecraftforge.event.village
Class 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 theFMLServerAboutToStartEvent
. It is used to gather the trade lists for each profession. It is fired on theMinecraftForge.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 byVillagerData.canLevelUp(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.
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>>
trades
protected VillagerProfession
type
-
Constructor Summary
Constructors Constructor Description VillagerTradesEvent(it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> trades, VillagerProfession type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>>
getTrades()
VillagerProfession
getType()
-
-
-
Field Detail
-
trades
protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> trades
-
type
protected VillagerProfession type
-
-
Constructor Detail
-
VillagerTradesEvent
public VillagerTradesEvent(it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> trades, VillagerProfession type)
-
-
Method Detail
-
getTrades
public it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<VillagerTrades.ITrade>> getTrades()
-
getType
public VillagerProfession getType()
-
-