public final class TradeOfferHelper extends Object
Constructor and Description |
---|
TradeOfferHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
refreshOffers()
Refreshes the trade list by resetting the trade lists to vanilla state, and then registering all trade offers again.
|
static void |
registerVillagerOffers(net.minecraft.village.VillagerProfession profession,
int level,
Consumer<List<net.minecraft.village.TradeOffers.Factory>> factories)
Registers trade offer factories for use by villagers.
|
static void |
registerWanderingTraderOffers(int level,
Consumer<List<net.minecraft.village.TradeOffers.Factory>> factory)
Registers trade offer factories for use by wandering trades.
|
public static void registerVillagerOffers(net.minecraft.village.VillagerProfession profession, int level, Consumer<List<net.minecraft.village.TradeOffers.Factory>> factories)
Below is an example, of registering a trade off factory to be added a blacksmith with a profession level of 3:
TradeOfferHelper.registerVillagerOffers(VillagerProfession.BLACKSMITH, 3, factories -> { factories.add(new CustomTradeFactory(...); });
profession
- the villager profession to assign the trades tolevel
- the profession level the villager must be to offer the tradesfactories
- a consumer to provide the factoriespublic static void registerWanderingTraderOffers(int level, Consumer<List<net.minecraft.village.TradeOffers.Factory>> factory)
level
- the level the tradesfactory
- a consumer to provide the factoriespublic static void refreshOffers()
This method is geared for use by mods which for example provide data driven villager trades.