Class WandererTradesEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.village.WandererTradesEvent
public class WandererTradesEvent
extends net.neoforged.bus.api.Event
WandererTradesEvent is fired during reload by
TagsUpdatedEvent
. It is used to gather the trade lists for the wandering merchant.
It is fired on the NeoForge.EVENT_BUS
.
For each set of trades the wandering merchant picks the specified amount of trades from the corresponding list.
To add trades to the merchant, simply add new trades to the list. BasicItemListing
provides a default implementation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
<org.apache.commons.lang3.tuple.Pair<List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing>, Integer>> protected List
<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> protected int
protected List
<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> protected int
protected List
<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> protected int
private final net.minecraft.core.HolderLookup.Provider
-
Constructor Summary
ConstructorsConstructorDescriptionWandererTradesEvent
(List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> buying, int buyingAmount, List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> rare, int rareAmount, List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> generic, int genericAmount, List<org.apache.commons.lang3.tuple.Pair<List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing>, Integer>> additionalTrades, net.minecraft.core.HolderLookup.Provider registries) -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
List
<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> int
List
<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> int
List
<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> net.minecraft.core.HolderLookup.Provider
void
setBuyingAmount
(int amount) void
setGenericAmount
(int amount) void
setRareAmount
(int amount)
-
Field Details
-
buying
-
buyingAmount
protected int buyingAmount -
rare
-
rareAmount
protected int rareAmount -
generic
-
genericAmount
protected int genericAmount -
additionalTrades
-
registries
private final net.minecraft.core.HolderLookup.Provider registries
-
-
Constructor Details
-
WandererTradesEvent
@Internal public WandererTradesEvent(List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> buying, int buyingAmount, List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> rare, int rareAmount, List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> generic, int genericAmount, List<org.apache.commons.lang3.tuple.Pair<List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing>, Integer>> additionalTrades, net.minecraft.core.HolderLookup.Provider registries)
-
-
Method Details
-
getBuyingTrades
-
getBuyingAmount
public int getBuyingAmount() -
setBuyingAmount
public void setBuyingAmount(int amount) -
getRareTrades
-
getRareAmount
public int getRareAmount() -
setRareAmount
public void setRareAmount(int amount) -
getGenericTrades
-
getGenericAmount
public int getGenericAmount() -
setGenericAmount
public void setGenericAmount(int amount) -
addTrades
public void addTrades(List<net.minecraft.world.entity.npc.VillagerTrades.ItemListing> trades, int amount) -
getRegistries
public net.minecraft.core.HolderLookup.Provider getRegistries()
-