Class TradeRegistry
java.lang.Object
me.shedaniel.architectury.registry.trade.TradeRegistry
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Register a callback which provideVillagerTradeOfferContext
to modify the given offer from a villager.static void
Register a callback which provideWanderingTraderOfferContext
to modify the given offer from the wandering trader.static void
registerTradeForWanderingTrader
(boolean rare, net.minecraft.world.entity.npc.VillagerTrades.ItemListing... trades) Register a trade (VillagerTrades.ItemListing
) to a wandering trader by its rarity.static void
registerVillagerTrade
(net.minecraft.world.entity.npc.VillagerProfession profession, int level, net.minecraft.world.entity.npc.VillagerTrades.ItemListing... trades) Register a trade (VillagerTrades.ItemListing
) for a villager by its profession and level.static void
Register a filter which provideVillagerTradeOfferContext
to test the given offer from a villager.static void
Register a filter which provideWanderingTraderOfferContext
to test the given offer from the wandering trader.static void
setVillagerMaxOffers
(net.minecraft.world.entity.npc.VillagerProfession profession, int level, int maxOffers) Override the max possible offers a villager can have by its profession and level.static void
setWanderingTraderMaxOffers
(int maxOffers) Override the max possible offers the wandering trader can have.
-
Method Details
-
registerVillagerTrade
public static void registerVillagerTrade(net.minecraft.world.entity.npc.VillagerProfession profession, int level, net.minecraft.world.entity.npc.VillagerTrades.ItemListing... trades) Register a trade (VillagerTrades.ItemListing
) for a villager by its profession and level. When the mod loader is Forge, theVillagerTradesEvent
event is used.- Parameters:
profession
- The Profession the villager needs to have this trade.level
- The level the villager needs. Vanilla range is 1 to 5, however mods may extend that upper limit further.trades
- The trades to add to this profession at the specified level.
-
setVillagerMaxOffers
public static void setVillagerMaxOffers(net.minecraft.world.entity.npc.VillagerProfession profession, int level, int maxOffers) Override the max possible offers a villager can have by its profession and level.- Parameters:
profession
- The Profession of the villager.level
- The level of the villager. Vanilla range is 1 to 5, however mods may extend that upper limit further.maxOffers
- Max possible offers a villager can have.
-
modifyVillagerOffers
Register a callback which provideVillagerTradeOfferContext
to modify the given offer from a villager. The callback gets called whenVillager
generates their offer list.- Parameters:
callback
- The callback to handle modification for the given offer context.
-
removeVillagerOffers
Register a filter which provideVillagerTradeOfferContext
to test the given offer from a villager. The filter gets called whenVillager
generates their offer list.- Parameters:
filter
- The filter to test if an offer should be removed. Returning true means the offer will be removed.
-
modifyWanderingTraderOffers
Register a callback which provideWanderingTraderOfferContext
to modify the given offer from the wandering trader. The callback gets called whenWanderingTrader
generates their offer list.- Parameters:
callback
- The callback to handle modification for the given offer context.
-
removeWanderingTraderOffers
Register a filter which provideWanderingTraderOfferContext
to test the given offer from the wandering trader. The filter gets called whenWanderingTrader
generates their offer list.- Parameters:
filter
- The filter to test if an offer should be removed. Returning true means the offer will be removed.
-
registerTradeForWanderingTrader
public static void registerTradeForWanderingTrader(boolean rare, net.minecraft.world.entity.npc.VillagerTrades.ItemListing... trades) Register a trade (VillagerTrades.ItemListing
) to a wandering trader by its rarity. When the mod loader is Forge, theWandererTradesEvent
event is used.- Parameters:
rare
- Whether this trade is "rare". Rare trades have a five times lower chance of being used.trades
- The trades to add to the wandering trader.
-
setWanderingTraderMaxOffers
public static void setWanderingTraderMaxOffers(int maxOffers) Override the max possible offers the wandering trader can have. This does not affect the rare trade.- Parameters:
maxOffers
- Max possible offers a villager can have.
-