Package net.minecraft.village
Class TradeOffer
java.lang.Object
net.minecraft.village.TradeOffer
- Mappings:
Namespace Name named net/minecraft/village/TradeOfferintermediary net/minecraft/class_1914official duh
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<TradeOffer> private intprivate final TradedItemprivate final intprivate final intstatic final PacketCodec<RegistryByteBuf, TradeOffer> private final floatprivate final booleanprivate final Optional<TradedItem> private final ItemStackprivate intprivate int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience) TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier) TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) TradeOffer(TradedItem buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) privateTradeOffer(TradeOffer offer) -
Method Summary
Modifier and TypeMethodDescriptionvoidResets the special price of this trade offer.copy()Returns a copy of the sell item of this trade offer.booleandepleteBuyItems(ItemStack firstBuyStack, ItemStack secondBuyStack) voiddisable()Sets the number of times this trade offer has been used to its maximum uses, making it disabled.intReturns the demand bonus of this trade offer.Returns a copy of the first buy item of this trade offer, with its price adjusted depending on the demand bonus, the special price and the price multiplier.Returns the second buy item of this trade offer.private intgetFirstBuyItemCount(TradedItem firstBuyItem) intReturns the maximum number of times this trade offer can be used.intReturns the amount of experience that will be given to a merchant after this trade offer has been used.Returns the first buy item of this trade offer.floatReturns the price multiplier of this trade offer.Returns the sell item of this trade offer.intReturns the special price of this trade offer.intgetUses()Returns the number of times this trade offer has been used.booleanReturns whether this trade offer has already been used.voidincreaseSpecialPrice(int increment) Increases the special price of this trade offer byincrement.booleanReturns whether this trade offer is disabled.booleanmatchesBuyItems(ItemStack stack, ItemStack buyItem) static TradeOfferread(RegistryByteBuf buf) voidResets the number of times this trade offer has been used.voidsetSpecialPrice(int specialPrice) Sets the special price of this trade offer tospecialPrice.booleanReturns whether experience should be given to a player when they use this trade offer.voidUpdates the demand bonus of this trade offer depending on its previous demand bonus, the number of times it has been used and its remaining uses.voiduse()Increments the number of times this trade offer has been used.private static voidwrite(RegistryByteBuf buf, TradeOffer offer)
-
Field Details
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/village/TradeOffer;CODEC:Lcom/mojang/serialization/Codec;intermediary field_48849Lnet/minecraft/class_1914;field_48849:Lcom/mojang/serialization/Codec;official aLduh;a:Lcom/mojang/serialization/Codec;
-
PACKET_CODEC
- Mappings:
Namespace Name Mixin selector named PACKET_CODECLnet/minecraft/village/TradeOffer;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;intermediary field_48371Lnet/minecraft/class_1914;field_48371:Lnet/minecraft/class_9139;official bLduh;b:Laao;
-
firstBuyItem
- Mappings:
Namespace Name Mixin selector named firstBuyItemLnet/minecraft/village/TradeOffer;firstBuyItem:Lnet/minecraft/village/TradedItem;intermediary field_9146Lnet/minecraft/class_1914;field_9146:Lnet/minecraft/class_9306;official cLduh;c:Lduf;
-
secondBuyItem
- Mappings:
Namespace Name Mixin selector named secondBuyItemLnet/minecraft/village/TradeOffer;secondBuyItem:Ljava/util/Optional;intermediary field_9143Lnet/minecraft/class_1914;field_9143:Ljava/util/Optional;official dLduh;d:Ljava/util/Optional;
-
sellItem
- Mappings:
Namespace Name Mixin selector named sellItemLnet/minecraft/village/TradeOffer;sellItem:Lnet/minecraft/item/ItemStack;intermediary field_9148Lnet/minecraft/class_1914;field_9148:Lnet/minecraft/class_1799;official eLduh;e:Ldkq;
-
uses
private int uses- Mappings:
Namespace Name Mixin selector named usesLnet/minecraft/village/TradeOffer;uses:Iintermediary field_9147Lnet/minecraft/class_1914;field_9147:Iofficial fLduh;f:I
-
maxUses
private final int maxUses- Mappings:
Namespace Name Mixin selector named maxUsesLnet/minecraft/village/TradeOffer;maxUses:Iintermediary field_9144Lnet/minecraft/class_1914;field_9144:Iofficial gLduh;g:I
-
rewardingPlayerExperience
private final boolean rewardingPlayerExperience- Mappings:
Namespace Name Mixin selector named rewardingPlayerExperienceLnet/minecraft/village/TradeOffer;rewardingPlayerExperience:Zintermediary field_9145Lnet/minecraft/class_1914;field_9145:Zofficial hLduh;h:Z
-
specialPrice
private int specialPrice- Mappings:
Namespace Name Mixin selector named specialPriceLnet/minecraft/village/TradeOffer;specialPrice:Iintermediary field_18676Lnet/minecraft/class_1914;field_18676:Iofficial iLduh;i:I
-
demandBonus
private int demandBonus- Mappings:
Namespace Name Mixin selector named demandBonusLnet/minecraft/village/TradeOffer;demandBonus:Iintermediary field_18677Lnet/minecraft/class_1914;field_18677:Iofficial jLduh;j:I
-
priceMultiplier
private final float priceMultiplier- Mappings:
Namespace Name Mixin selector named priceMultiplierLnet/minecraft/village/TradeOffer;priceMultiplier:Fintermediary field_18678Lnet/minecraft/class_1914;field_18678:Fofficial kLduh;k:F
-
merchantExperience
private final int merchantExperience- Mappings:
Namespace Name Mixin selector named merchantExperienceLnet/minecraft/village/TradeOffer;merchantExperience:Iintermediary field_18679Lnet/minecraft/class_1914;field_18679:Iofficial lLduh;l:I
-
-
Constructor Details
-
TradeOffer
private TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;IIZIIFI)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIZIIFI)Vofficial <init>Lduh;<init>(Lduf;Ljava/util/Optional;Ldkq;IIZIIFI)V
-
TradeOffer
public TradeOffer(TradedItem buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Lnet/minecraft/item/ItemStack;IIF)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Lnet/minecraft/class_1799;IIF)Vofficial <init>Lduh;<init>(Lduf;Ldkq;IIF)V
-
TradeOffer
public TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;IIF)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIF)Vofficial <init>Lduh;<init>(Lduf;Ljava/util/Optional;Ldkq;IIF)V
-
TradeOffer
public TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;IIIF)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIF)Vofficial <init>Lduh;<init>(Lduf;Ljava/util/Optional;Ldkq;IIIF)V
-
TradeOffer
public TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;IIIFI)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIFI)Vofficial <init>Lduh;<init>(Lduf;Ljava/util/Optional;Ldkq;IIIFI)V
-
TradeOffer
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradeOffer;)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_1914;)Vofficial <init>Lduh;<init>(Lduh;)V
-
-
Method Details
-
getOriginalFirstBuyItem
Returns the first buy item of this trade offer.- Mappings:
Namespace Name Mixin selector named getOriginalFirstBuyItemLnet/minecraft/village/TradeOffer;getOriginalFirstBuyItem()Lnet/minecraft/item/ItemStack;intermediary method_8246Lnet/minecraft/class_1914;method_8246()Lnet/minecraft/class_1799;official aLduh;a()Ldkq;
-
getDisplayedFirstBuyItem
Returns a copy of the first buy item of this trade offer, with its price adjusted depending on the demand bonus, the special price and the price multiplier.- Mappings:
Namespace Name Mixin selector named getDisplayedFirstBuyItemLnet/minecraft/village/TradeOffer;getDisplayedFirstBuyItem()Lnet/minecraft/item/ItemStack;intermediary method_19272Lnet/minecraft/class_1914;method_19272()Lnet/minecraft/class_1799;official bLduh;b()Ldkq;
-
getFirstBuyItemCount
- Mappings:
Namespace Name Mixin selector named getFirstBuyItemCountLnet/minecraft/village/TradeOffer;getFirstBuyItemCount(Lnet/minecraft/village/TradedItem;)Iintermediary method_57555Lnet/minecraft/class_1914;method_57555(Lnet/minecraft/class_9306;)Iofficial aLduh;a(Lduf;)I
-
getDisplayedSecondBuyItem
Returns the second buy item of this trade offer.If there is no second buy item, this returns the empty item stack.
- Mappings:
Namespace Name Mixin selector named getDisplayedSecondBuyItemLnet/minecraft/village/TradeOffer;getDisplayedSecondBuyItem()Lnet/minecraft/item/ItemStack;intermediary method_8247Lnet/minecraft/class_1914;method_8247()Lnet/minecraft/class_1799;official cLduh;c()Ldkq;
-
getFirstBuyItem
- Mappings:
Namespace Name Mixin selector named getFirstBuyItemLnet/minecraft/village/TradeOffer;getFirstBuyItem()Lnet/minecraft/village/TradedItem;intermediary method_57556Lnet/minecraft/class_1914;method_57556()Lnet/minecraft/class_9306;official dLduh;d()Lduf;
-
getSecondBuyItem
- Mappings:
Namespace Name Mixin selector named getSecondBuyItemLnet/minecraft/village/TradeOffer;getSecondBuyItem()Ljava/util/Optional;intermediary method_57557Lnet/minecraft/class_1914;method_57557()Ljava/util/Optional;official eLduh;e()Ljava/util/Optional;
-
getSellItem
Returns the sell item of this trade offer.- Mappings:
Namespace Name Mixin selector named getSellItemLnet/minecraft/village/TradeOffer;getSellItem()Lnet/minecraft/item/ItemStack;intermediary method_8250Lnet/minecraft/class_1914;method_8250()Lnet/minecraft/class_1799;official fLduh;f()Ldkq;
-
updateDemandBonus
public void updateDemandBonus()Updates the demand bonus of this trade offer depending on its previous demand bonus, the number of times it has been used and its remaining uses.- Mappings:
Namespace Name Mixin selector named updateDemandBonusLnet/minecraft/village/TradeOffer;updateDemandBonus()Vintermediary method_19274Lnet/minecraft/class_1914;method_19274()Vofficial gLduh;g()V
-
copySellItem
Returns a copy of the sell item of this trade offer.- Mappings:
Namespace Name Mixin selector named copySellItemLnet/minecraft/village/TradeOffer;copySellItem()Lnet/minecraft/item/ItemStack;intermediary method_18019Lnet/minecraft/class_1914;method_18019()Lnet/minecraft/class_1799;official hLduh;h()Ldkq;
-
getUses
public int getUses()Returns the number of times this trade offer has been used.- Mappings:
Namespace Name Mixin selector named getUsesLnet/minecraft/village/TradeOffer;getUses()Iintermediary method_8249Lnet/minecraft/class_1914;method_8249()Iofficial iLduh;i()I
-
resetUses
public void resetUses()Resets the number of times this trade offer has been used.- Mappings:
Namespace Name Mixin selector named resetUsesLnet/minecraft/village/TradeOffer;resetUses()Vintermediary method_19275Lnet/minecraft/class_1914;method_19275()Vofficial jLduh;j()V
-
getMaxUses
public int getMaxUses()Returns the maximum number of times this trade offer can be used.- Mappings:
Namespace Name Mixin selector named getMaxUsesLnet/minecraft/village/TradeOffer;getMaxUses()Iintermediary method_8248Lnet/minecraft/class_1914;method_8248()Iofficial kLduh;k()I
-
use
public void use()Increments the number of times this trade offer has been used.- Mappings:
Namespace Name Mixin selector named useLnet/minecraft/village/TradeOffer;use()Vintermediary method_8244Lnet/minecraft/class_1914;method_8244()Vofficial lLduh;l()V
-
getDemandBonus
public int getDemandBonus()Returns the demand bonus of this trade offer. It is used to adjust the price of its first buy item.The more the demand bonus is, the more the price will be high.
It is updated when a villager restocks.
- See Also:
- Mappings:
Namespace Name Mixin selector named getDemandBonusLnet/minecraft/village/TradeOffer;getDemandBonus()Iintermediary method_21725Lnet/minecraft/class_1914;method_21725()Iofficial mLduh;m()I
-
increaseSpecialPrice
public void increaseSpecialPrice(int increment) Increases the special price of this trade offer byincrement.A negative
incrementvalue will decrease the special price.- Mappings:
Namespace Name Mixin selector named increaseSpecialPriceLnet/minecraft/village/TradeOffer;increaseSpecialPrice(I)Vintermediary method_8245Lnet/minecraft/class_1914;method_8245(I)Vofficial aLduh;a(I)V
-
clearSpecialPrice
public void clearSpecialPrice()Resets the special price of this trade offer.- Mappings:
Namespace Name Mixin selector named clearSpecialPriceLnet/minecraft/village/TradeOffer;clearSpecialPrice()Vintermediary method_19276Lnet/minecraft/class_1914;method_19276()Vofficial nLduh;n()V
-
getSpecialPrice
public int getSpecialPrice()Returns the special price of this trade offer. It is used to adjust the price of its first buy item.The less the special price is, the more the price will be low.
- Mappings:
Namespace Name Mixin selector named getSpecialPriceLnet/minecraft/village/TradeOffer;getSpecialPrice()Iintermediary method_19277Lnet/minecraft/class_1914;method_19277()Iofficial oLduh;o()I
-
setSpecialPrice
public void setSpecialPrice(int specialPrice) Sets the special price of this trade offer tospecialPrice.- Mappings:
Namespace Name Mixin selector named setSpecialPriceLnet/minecraft/village/TradeOffer;setSpecialPrice(I)Vintermediary method_19273Lnet/minecraft/class_1914;method_19273(I)Vofficial bLduh;b(I)V
-
getPriceMultiplier
public float getPriceMultiplier()Returns the price multiplier of this trade offer. It is used to adjust the price of its first buy item.- Mappings:
Namespace Name Mixin selector named getPriceMultiplierLnet/minecraft/village/TradeOffer;getPriceMultiplier()Fintermediary method_19278Lnet/minecraft/class_1914;method_19278()Fofficial pLduh;p()F
-
getMerchantExperience
public int getMerchantExperience()Returns the amount of experience that will be given to a merchant after this trade offer has been used.- Mappings:
Namespace Name Mixin selector named getMerchantExperienceLnet/minecraft/village/TradeOffer;getMerchantExperience()Iintermediary method_19279Lnet/minecraft/class_1914;method_19279()Iofficial qLduh;q()I
-
isDisabled
public boolean isDisabled()Returns whether this trade offer is disabled.Checks if the number of times this trade offer has been used is greater or equal to its maximum uses.
- Mappings:
Namespace Name Mixin selector named isDisabledLnet/minecraft/village/TradeOffer;isDisabled()Zintermediary method_8255Lnet/minecraft/class_1914;method_8255()Zofficial rLduh;r()Z
-
disable
public void disable()Sets the number of times this trade offer has been used to its maximum uses, making it disabled.- Mappings:
Namespace Name Mixin selector named disableLnet/minecraft/village/TradeOffer;disable()Vintermediary method_8254Lnet/minecraft/class_1914;method_8254()Vofficial sLduh;s()V
-
hasBeenUsed
public boolean hasBeenUsed()Returns whether this trade offer has already been used.Checks if the number of times this trade offer has been used is greater than 0.
- Mappings:
Namespace Name Mixin selector named hasBeenUsedLnet/minecraft/village/TradeOffer;hasBeenUsed()Zintermediary method_21834Lnet/minecraft/class_1914;method_21834()Zofficial tLduh;t()Z
-
shouldRewardPlayerExperience
public boolean shouldRewardPlayerExperience()Returns whether experience should be given to a player when they use this trade offer.- Mappings:
Namespace Name Mixin selector named shouldRewardPlayerExperienceLnet/minecraft/village/TradeOffer;shouldRewardPlayerExperience()Zintermediary method_8256Lnet/minecraft/class_1914;method_8256()Zofficial uLduh;u()Z
-
matchesBuyItems
- Mappings:
Namespace Name Mixin selector named matchesBuyItemsLnet/minecraft/village/TradeOffer;matchesBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Zintermediary method_16952Lnet/minecraft/class_1914;method_16952(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Zofficial aLduh;a(Ldkq;Ldkq;)Z
-
depleteBuyItems
- Mappings:
Namespace Name Mixin selector named depleteBuyItemsLnet/minecraft/village/TradeOffer;depleteBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Zintermediary method_16953Lnet/minecraft/class_1914;method_16953(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Zofficial bLduh;b(Ldkq;Ldkq;)Z
-
copy
- Mappings:
Namespace Name Mixin selector named copyLnet/minecraft/village/TradeOffer;copy()Lnet/minecraft/village/TradeOffer;intermediary method_53881Lnet/minecraft/class_1914;method_53881()Lnet/minecraft/class_1914;official vLduh;v()Lduh;
-
write
- Mappings:
Namespace Name Mixin selector named writeLnet/minecraft/village/TradeOffer;write(Lnet/minecraft/network/RegistryByteBuf;Lnet/minecraft/village/TradeOffer;)Vintermediary method_56111Lnet/minecraft/class_1914;method_56111(Lnet/minecraft/class_9129;Lnet/minecraft/class_1914;)Vofficial aLduh;a(Lxq;Lduh;)V
-
read
- Mappings:
Namespace Name Mixin selector named readLnet/minecraft/village/TradeOffer;read(Lnet/minecraft/network/RegistryByteBuf;)Lnet/minecraft/village/TradeOffer;intermediary method_56110Lnet/minecraft/class_1914;method_56110(Lnet/minecraft/class_9129;)Lnet/minecraft/class_1914;official aLduh;a(Lxq;)Lduh;
-