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.This never did anything useful.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.
-
Method Details
-
registerVillagerOffers
public 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.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(...); });
- 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<net.minecraft.village.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.This never did anything useful.
-