Package net.minecraft.village
Class TradeOffer
java.lang.Object
net.minecraft.village.TradeOffer
- Mappings:
Namespace Name official cyeintermediary net/minecraft/class_1914named net/minecraft/village/TradeOffer
-
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 official aLcye;a:Lcom/mojang/serialization/Codec;intermediary field_48849Lnet/minecraft/class_1914;field_48849:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/village/TradeOffer;CODEC:Lcom/mojang/serialization/Codec;
-
PACKET_CODEC
- Mappings:
Namespace Name Mixin selector official bLcye;b:Lyg;intermediary field_48371Lnet/minecraft/class_1914;field_48371:Lnet/minecraft/class_9139;named PACKET_CODECLnet/minecraft/village/TradeOffer;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
-
firstBuyItem
- Mappings:
Namespace Name Mixin selector official cLcye;c:Lcyc;intermediary field_9146Lnet/minecraft/class_1914;field_9146:Lnet/minecraft/class_9306;named firstBuyItemLnet/minecraft/village/TradeOffer;firstBuyItem:Lnet/minecraft/village/TradedItem;
-
secondBuyItem
- Mappings:
Namespace Name Mixin selector official dLcye;d:Ljava/util/Optional;intermediary field_9143Lnet/minecraft/class_1914;field_9143:Ljava/util/Optional;named secondBuyItemLnet/minecraft/village/TradeOffer;secondBuyItem:Ljava/util/Optional;
-
sellItem
- Mappings:
Namespace Name Mixin selector official eLcye;e:Lcrs;intermediary field_9148Lnet/minecraft/class_1914;field_9148:Lnet/minecraft/class_1799;named sellItemLnet/minecraft/village/TradeOffer;sellItem:Lnet/minecraft/item/ItemStack;
-
uses
private int uses- Mappings:
Namespace Name Mixin selector official fLcye;f:Iintermediary field_9147Lnet/minecraft/class_1914;field_9147:Inamed usesLnet/minecraft/village/TradeOffer;uses:I
-
maxUses
private final int maxUses- Mappings:
Namespace Name Mixin selector official gLcye;g:Iintermediary field_9144Lnet/minecraft/class_1914;field_9144:Inamed maxUsesLnet/minecraft/village/TradeOffer;maxUses:I
-
rewardingPlayerExperience
private final boolean rewardingPlayerExperience- Mappings:
Namespace Name Mixin selector official hLcye;h:Zintermediary field_9145Lnet/minecraft/class_1914;field_9145:Znamed rewardingPlayerExperienceLnet/minecraft/village/TradeOffer;rewardingPlayerExperience:Z
-
specialPrice
private int specialPrice- Mappings:
Namespace Name Mixin selector official iLcye;i:Iintermediary field_18676Lnet/minecraft/class_1914;field_18676:Inamed specialPriceLnet/minecraft/village/TradeOffer;specialPrice:I
-
demandBonus
private int demandBonus- Mappings:
Namespace Name Mixin selector official jLcye;j:Iintermediary field_18677Lnet/minecraft/class_1914;field_18677:Inamed demandBonusLnet/minecraft/village/TradeOffer;demandBonus:I
-
priceMultiplier
private final float priceMultiplier- Mappings:
Namespace Name Mixin selector official kLcye;k:Fintermediary field_18678Lnet/minecraft/class_1914;field_18678:Fnamed priceMultiplierLnet/minecraft/village/TradeOffer;priceMultiplier:F
-
merchantExperience
private final int merchantExperience- Mappings:
Namespace Name Mixin selector official lLcye;l:Iintermediary field_18679Lnet/minecraft/class_1914;field_18679:Inamed merchantExperienceLnet/minecraft/village/TradeOffer;merchantExperience: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 official <init>Lcye;<init>(Lcyc;Ljava/util/Optional;Lcrs;IIZIIFI)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIZIIFI)Vnamed <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;IIZIIFI)V
-
TradeOffer
public TradeOffer(TradedItem buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector official <init>Lcye;<init>(Lcyc;Lcrs;IIF)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Lnet/minecraft/class_1799;IIF)Vnamed <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Lnet/minecraft/item/ItemStack;IIF)V
-
TradeOffer
public TradeOffer(TradedItem firstBuyItem, Optional<TradedItem> secondBuyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector official <init>Lcye;<init>(Lcyc;Ljava/util/Optional;Lcrs;IIF)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIF)Vnamed <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;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 official <init>Lcye;<init>(Lcyc;Ljava/util/Optional;Lcrs;IIIF)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIF)Vnamed <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;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 official <init>Lcye;<init>(Lcyc;Ljava/util/Optional;Lcrs;IIIFI)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIFI)Vnamed <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradedItem;Ljava/util/Optional;Lnet/minecraft/item/ItemStack;IIIFI)V
-
TradeOffer
- Mappings:
Namespace Name Mixin selector official <init>Lcye;<init>(Lcye;)Vintermediary <init>Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_1914;)Vnamed <init>Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradeOffer;)V
-
-
Method Details
-
getOriginalFirstBuyItem
Returns the first buy item of this trade offer.- Mappings:
Namespace Name Mixin selector official aLcye;a()Lcrs;intermediary method_8246Lnet/minecraft/class_1914;method_8246()Lnet/minecraft/class_1799;named getOriginalFirstBuyItemLnet/minecraft/village/TradeOffer;getOriginalFirstBuyItem()Lnet/minecraft/item/ItemStack;
-
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 official bLcye;b()Lcrs;intermediary method_19272Lnet/minecraft/class_1914;method_19272()Lnet/minecraft/class_1799;named getDisplayedFirstBuyItemLnet/minecraft/village/TradeOffer;getDisplayedFirstBuyItem()Lnet/minecraft/item/ItemStack;
-
getFirstBuyItemCount
- Mappings:
Namespace Name Mixin selector official aLcye;a(Lcyc;)Iintermediary method_57555Lnet/minecraft/class_1914;method_57555(Lnet/minecraft/class_9306;)Inamed getFirstBuyItemCountLnet/minecraft/village/TradeOffer;getFirstBuyItemCount(Lnet/minecraft/village/TradedItem;)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 official cLcye;c()Lcrs;intermediary method_8247Lnet/minecraft/class_1914;method_8247()Lnet/minecraft/class_1799;named getDisplayedSecondBuyItemLnet/minecraft/village/TradeOffer;getDisplayedSecondBuyItem()Lnet/minecraft/item/ItemStack;
-
getFirstBuyItem
- Mappings:
Namespace Name Mixin selector official dLcye;d()Lcyc;intermediary method_57556Lnet/minecraft/class_1914;method_57556()Lnet/minecraft/class_9306;named getFirstBuyItemLnet/minecraft/village/TradeOffer;getFirstBuyItem()Lnet/minecraft/village/TradedItem;
-
getSecondBuyItem
- Mappings:
Namespace Name Mixin selector official eLcye;e()Ljava/util/Optional;intermediary method_57557Lnet/minecraft/class_1914;method_57557()Ljava/util/Optional;named getSecondBuyItemLnet/minecraft/village/TradeOffer;getSecondBuyItem()Ljava/util/Optional;
-
getSellItem
Returns the sell item of this trade offer.- Mappings:
Namespace Name Mixin selector official fLcye;f()Lcrs;intermediary method_8250Lnet/minecraft/class_1914;method_8250()Lnet/minecraft/class_1799;named getSellItemLnet/minecraft/village/TradeOffer;getSellItem()Lnet/minecraft/item/ItemStack;
-
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 official gLcye;g()Vintermediary method_19274Lnet/minecraft/class_1914;method_19274()Vnamed updateDemandBonusLnet/minecraft/village/TradeOffer;updateDemandBonus()V
-
copySellItem
Returns a copy of the sell item of this trade offer.- Mappings:
Namespace Name Mixin selector official hLcye;h()Lcrs;intermediary method_18019Lnet/minecraft/class_1914;method_18019()Lnet/minecraft/class_1799;named copySellItemLnet/minecraft/village/TradeOffer;copySellItem()Lnet/minecraft/item/ItemStack;
-
getUses
public int getUses()Returns the number of times this trade offer has been used.- Mappings:
Namespace Name Mixin selector official iLcye;i()Iintermediary method_8249Lnet/minecraft/class_1914;method_8249()Inamed getUsesLnet/minecraft/village/TradeOffer;getUses()I
-
resetUses
public void resetUses()Resets the number of times this trade offer has been used.- Mappings:
Namespace Name Mixin selector official jLcye;j()Vintermediary method_19275Lnet/minecraft/class_1914;method_19275()Vnamed resetUsesLnet/minecraft/village/TradeOffer;resetUses()V
-
getMaxUses
public int getMaxUses()Returns the maximum number of times this trade offer can be used.- Mappings:
Namespace Name Mixin selector official kLcye;k()Iintermediary method_8248Lnet/minecraft/class_1914;method_8248()Inamed getMaxUsesLnet/minecraft/village/TradeOffer;getMaxUses()I
-
use
public void use()Increments the number of times this trade offer has been used.- Mappings:
Namespace Name Mixin selector official lLcye;l()Vintermediary method_8244Lnet/minecraft/class_1914;method_8244()Vnamed useLnet/minecraft/village/TradeOffer;use()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 official mLcye;m()Iintermediary method_21725Lnet/minecraft/class_1914;method_21725()Inamed getDemandBonusLnet/minecraft/village/TradeOffer;getDemandBonus()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 official aLcye;a(I)Vintermediary method_8245Lnet/minecraft/class_1914;method_8245(I)Vnamed increaseSpecialPriceLnet/minecraft/village/TradeOffer;increaseSpecialPrice(I)V
-
clearSpecialPrice
public void clearSpecialPrice()Resets the special price of this trade offer.- Mappings:
Namespace Name Mixin selector official nLcye;n()Vintermediary method_19276Lnet/minecraft/class_1914;method_19276()Vnamed clearSpecialPriceLnet/minecraft/village/TradeOffer;clearSpecialPrice()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 official oLcye;o()Iintermediary method_19277Lnet/minecraft/class_1914;method_19277()Inamed getSpecialPriceLnet/minecraft/village/TradeOffer;getSpecialPrice()I
-
setSpecialPrice
public void setSpecialPrice(int specialPrice) Sets the special price of this trade offer tospecialPrice.- Mappings:
Namespace Name Mixin selector official bLcye;b(I)Vintermediary method_19273Lnet/minecraft/class_1914;method_19273(I)Vnamed setSpecialPriceLnet/minecraft/village/TradeOffer;setSpecialPrice(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 official pLcye;p()Fintermediary method_19278Lnet/minecraft/class_1914;method_19278()Fnamed getPriceMultiplierLnet/minecraft/village/TradeOffer;getPriceMultiplier()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 official qLcye;q()Iintermediary method_19279Lnet/minecraft/class_1914;method_19279()Inamed getMerchantExperienceLnet/minecraft/village/TradeOffer;getMerchantExperience()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 official rLcye;r()Zintermediary method_8255Lnet/minecraft/class_1914;method_8255()Znamed isDisabledLnet/minecraft/village/TradeOffer;isDisabled()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 official sLcye;s()Vintermediary method_8254Lnet/minecraft/class_1914;method_8254()Vnamed disableLnet/minecraft/village/TradeOffer;disable()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 official tLcye;t()Zintermediary method_21834Lnet/minecraft/class_1914;method_21834()Znamed hasBeenUsedLnet/minecraft/village/TradeOffer;hasBeenUsed()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 official uLcye;u()Zintermediary method_8256Lnet/minecraft/class_1914;method_8256()Znamed shouldRewardPlayerExperienceLnet/minecraft/village/TradeOffer;shouldRewardPlayerExperience()Z
-
matchesBuyItems
- Mappings:
Namespace Name Mixin selector official aLcye;a(Lcrs;Lcrs;)Zintermediary method_16952Lnet/minecraft/class_1914;method_16952(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Znamed matchesBuyItemsLnet/minecraft/village/TradeOffer;matchesBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
depleteBuyItems
- Mappings:
Namespace Name Mixin selector official bLcye;b(Lcrs;Lcrs;)Zintermediary method_16953Lnet/minecraft/class_1914;method_16953(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Znamed depleteBuyItemsLnet/minecraft/village/TradeOffer;depleteBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
copy
- Mappings:
Namespace Name Mixin selector official vLcye;v()Lcye;intermediary method_53881Lnet/minecraft/class_1914;method_53881()Lnet/minecraft/class_1914;named copyLnet/minecraft/village/TradeOffer;copy()Lnet/minecraft/village/TradeOffer;
-
write
- Mappings:
Namespace Name Mixin selector official aLcye;a(Lvt;Lcye;)Vintermediary method_56111Lnet/minecraft/class_1914;method_56111(Lnet/minecraft/class_9129;Lnet/minecraft/class_1914;)Vnamed writeLnet/minecraft/village/TradeOffer;write(Lnet/minecraft/network/RegistryByteBuf;Lnet/minecraft/village/TradeOffer;)V
-
read
- Mappings:
Namespace Name Mixin selector official aLcye;a(Lvt;)Lcye;intermediary method_56110Lnet/minecraft/class_1914;method_56110(Lnet/minecraft/class_9129;)Lnet/minecraft/class_1914;named readLnet/minecraft/village/TradeOffer;read(Lnet/minecraft/network/RegistryByteBuf;)Lnet/minecraft/village/TradeOffer;
-