Class TradeOfferHelper
java.lang.Object
net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper
Utilities to help with registration of trade offers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Deprecated, for removal: This API element is subject to removal in a future version.This never did anything useful.static void
registerVillagerOffers
(VillagerProfession profession, int level, Consumer<List<TradeOffers.Factory>> factories) Registers trade offer factories for use by villagers.static void
registerWanderingTraderOffers
(int level, Consumer<List<TradeOffers.Factory>> factory) Registers trade offer factories for use by wandering trades.
-
Method Details
-
registerVillagerOffers
public static void registerVillagerOffers(VillagerProfession profession, int level, Consumer<List<TradeOffers.Factory>> factories) Registers trade offer factories for use by villagers.Below is an example, of registering a trade offer factory to be added a blacksmith with a profession level of 3:
TradeOfferHelper.registerVillagerOffers(VillagerProfession.BLACKSMITH, 3, factories -> { factories.add(new CustomTradeFactory(...); });
- Parameters:
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 factories
-
registerWanderingTraderOffers
public static void registerWanderingTraderOffers(int level, Consumer<List<TradeOffers.Factory>> factory) Registers trade offer factories for use by wandering trades.- Parameters:
level
- the level the tradesfactory
- a consumer to provide the factories
-
refreshOffers
Deprecated, for removal: This API element is subject to removal in a future version.This never did anything useful.
-