Class TradeOffer

java.lang.Object
net.minecraft.village.TradeOffer

public class TradeOffer extends Object
Mappings:
Namespace Name
named net/minecraft/village/TradeOffer
intermediary net/minecraft/class_1914
official dfg
  • Field Details Link icon

    • CODEC Link icon

      public static final com.mojang.serialization.Codec<TradeOffer> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/village/TradeOffer;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_48849 Lnet/minecraft/class_1914;field_48849:Lcom/mojang/serialization/Codec;
      official a Ldfg;a:Lcom/mojang/serialization/Codec;
    • PACKET_CODEC Link icon

      public static final PacketCodec<RegistryByteBuf,TradeOffer> PACKET_CODEC
      Mappings:
      Namespace Name Mixin selector
      named PACKET_CODEC Lnet/minecraft/village/TradeOffer;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
      intermediary field_48371 Lnet/minecraft/class_1914;field_48371:Lnet/minecraft/class_9139;
      official b Ldfg;b:Lyn;
    • firstBuyItem Link icon

      private final TradedItem firstBuyItem
      Mappings:
      Namespace Name Mixin selector
      named firstBuyItem Lnet/minecraft/village/TradeOffer;firstBuyItem:Lnet/minecraft/village/TradedItem;
      intermediary field_9146 Lnet/minecraft/class_1914;field_9146:Lnet/minecraft/class_9306;
      official c Ldfg;c:Ldfe;
    • secondBuyItem Link icon

      private final Optional<TradedItem> secondBuyItem
      Mappings:
      Namespace Name Mixin selector
      named secondBuyItem Lnet/minecraft/village/TradeOffer;secondBuyItem:Ljava/util/Optional;
      intermediary field_9143 Lnet/minecraft/class_1914;field_9143:Ljava/util/Optional;
      official d Ldfg;d:Ljava/util/Optional;
    • sellItem Link icon

      private final ItemStack sellItem
      Mappings:
      Namespace Name Mixin selector
      named sellItem Lnet/minecraft/village/TradeOffer;sellItem:Lnet/minecraft/item/ItemStack;
      intermediary field_9148 Lnet/minecraft/class_1914;field_9148:Lnet/minecraft/class_1799;
      official e Ldfg;e:Lcwq;
    • uses Link icon

      private int uses
      Mappings:
      Namespace Name Mixin selector
      named uses Lnet/minecraft/village/TradeOffer;uses:I
      intermediary field_9147 Lnet/minecraft/class_1914;field_9147:I
      official f Ldfg;f:I
    • maxUses Link icon

      private final int maxUses
      Mappings:
      Namespace Name Mixin selector
      named maxUses Lnet/minecraft/village/TradeOffer;maxUses:I
      intermediary field_9144 Lnet/minecraft/class_1914;field_9144:I
      official g Ldfg;g:I
    • rewardingPlayerExperience Link icon

      private final boolean rewardingPlayerExperience
      Mappings:
      Namespace Name Mixin selector
      named rewardingPlayerExperience Lnet/minecraft/village/TradeOffer;rewardingPlayerExperience:Z
      intermediary field_9145 Lnet/minecraft/class_1914;field_9145:Z
      official h Ldfg;h:Z
    • specialPrice Link icon

      private int specialPrice
      Mappings:
      Namespace Name Mixin selector
      named specialPrice Lnet/minecraft/village/TradeOffer;specialPrice:I
      intermediary field_18676 Lnet/minecraft/class_1914;field_18676:I
      official i Ldfg;i:I
    • demandBonus Link icon

      private int demandBonus
      Mappings:
      Namespace Name Mixin selector
      named demandBonus Lnet/minecraft/village/TradeOffer;demandBonus:I
      intermediary field_18677 Lnet/minecraft/class_1914;field_18677:I
      official j Ldfg;j:I
    • priceMultiplier Link icon

      private final float priceMultiplier
      Mappings:
      Namespace Name Mixin selector
      named priceMultiplier Lnet/minecraft/village/TradeOffer;priceMultiplier:F
      intermediary field_18678 Lnet/minecraft/class_1914;field_18678:F
      official k Ldfg;k:F
    • merchantExperience Link icon

      private final int merchantExperience
      Mappings:
      Namespace Name Mixin selector
      named merchantExperience Lnet/minecraft/village/TradeOffer;merchantExperience:I
      intermediary field_18679 Lnet/minecraft/class_1914;field_18679:I
      official l Ldfg;l:I
  • Constructor Details Link icon

    • TradeOffer Link icon

      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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIZIIFI)V
      official <init> Ldfg;<init>(Ldfe;Ljava/util/Optional;Lcwq;IIZIIFI)V
    • TradeOffer Link icon

      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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Lnet/minecraft/class_1799;IIF)V
      official <init> Ldfg;<init>(Ldfe;Lcwq;IIF)V
    • TradeOffer Link icon

      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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIF)V
      official <init> Ldfg;<init>(Ldfe;Ljava/util/Optional;Lcwq;IIF)V
    • TradeOffer Link icon

      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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIF)V
      official <init> Ldfg;<init>(Ldfe;Ljava/util/Optional;Lcwq;IIIF)V
    • TradeOffer Link icon

      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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIFI)V
      official <init> Ldfg;<init>(Ldfe;Ljava/util/Optional;Lcwq;IIIFI)V
    • TradeOffer Link icon

      private TradeOffer(TradeOffer offer)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/village/TradeOffer;)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_1914;)V
      official <init> Ldfg;<init>(Ldfg;)V
  • Method Details Link icon

    • getOriginalFirstBuyItem Link icon

      public ItemStack getOriginalFirstBuyItem()
      Returns the first buy item of this trade offer.
      Mappings:
      Namespace Name Mixin selector
      named getOriginalFirstBuyItem Lnet/minecraft/village/TradeOffer;getOriginalFirstBuyItem()Lnet/minecraft/item/ItemStack;
      intermediary method_8246 Lnet/minecraft/class_1914;method_8246()Lnet/minecraft/class_1799;
      official a Ldfg;a()Lcwq;
    • getDisplayedFirstBuyItem Link icon

      public 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
      named getDisplayedFirstBuyItem Lnet/minecraft/village/TradeOffer;getDisplayedFirstBuyItem()Lnet/minecraft/item/ItemStack;
      intermediary method_19272 Lnet/minecraft/class_1914;method_19272()Lnet/minecraft/class_1799;
      official b Ldfg;b()Lcwq;
    • getFirstBuyItemCount Link icon

      private int getFirstBuyItemCount(TradedItem firstBuyItem)
      Mappings:
      Namespace Name Mixin selector
      named getFirstBuyItemCount Lnet/minecraft/village/TradeOffer;getFirstBuyItemCount(Lnet/minecraft/village/TradedItem;)I
      intermediary method_57555 Lnet/minecraft/class_1914;method_57555(Lnet/minecraft/class_9306;)I
      official a Ldfg;a(Ldfe;)I
    • getDisplayedSecondBuyItem Link icon

      public ItemStack 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 getDisplayedSecondBuyItem Lnet/minecraft/village/TradeOffer;getDisplayedSecondBuyItem()Lnet/minecraft/item/ItemStack;
      intermediary method_8247 Lnet/minecraft/class_1914;method_8247()Lnet/minecraft/class_1799;
      official c Ldfg;c()Lcwq;
    • getFirstBuyItem Link icon

      public TradedItem getFirstBuyItem()
      Mappings:
      Namespace Name Mixin selector
      named getFirstBuyItem Lnet/minecraft/village/TradeOffer;getFirstBuyItem()Lnet/minecraft/village/TradedItem;
      intermediary method_57556 Lnet/minecraft/class_1914;method_57556()Lnet/minecraft/class_9306;
      official d Ldfg;d()Ldfe;
    • getSecondBuyItem Link icon

      public Optional<TradedItem> getSecondBuyItem()
      Mappings:
      Namespace Name Mixin selector
      named getSecondBuyItem Lnet/minecraft/village/TradeOffer;getSecondBuyItem()Ljava/util/Optional;
      intermediary method_57557 Lnet/minecraft/class_1914;method_57557()Ljava/util/Optional;
      official e Ldfg;e()Ljava/util/Optional;
    • getSellItem Link icon

      public ItemStack getSellItem()
      Returns the sell item of this trade offer.
      Mappings:
      Namespace Name Mixin selector
      named getSellItem Lnet/minecraft/village/TradeOffer;getSellItem()Lnet/minecraft/item/ItemStack;
      intermediary method_8250 Lnet/minecraft/class_1914;method_8250()Lnet/minecraft/class_1799;
      official f Ldfg;f()Lcwq;
    • updateDemandBonus Link icon

      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 updateDemandBonus Lnet/minecraft/village/TradeOffer;updateDemandBonus()V
      intermediary method_19274 Lnet/minecraft/class_1914;method_19274()V
      official g Ldfg;g()V
    • copySellItem Link icon

      public ItemStack copySellItem()
      Returns a copy of the sell item of this trade offer.
      Mappings:
      Namespace Name Mixin selector
      named copySellItem Lnet/minecraft/village/TradeOffer;copySellItem()Lnet/minecraft/item/ItemStack;
      intermediary method_18019 Lnet/minecraft/class_1914;method_18019()Lnet/minecraft/class_1799;
      official h Ldfg;h()Lcwq;
    • getUses Link icon

      public int getUses()
      Returns the number of times this trade offer has been used.
      Mappings:
      Namespace Name Mixin selector
      named getUses Lnet/minecraft/village/TradeOffer;getUses()I
      intermediary method_8249 Lnet/minecraft/class_1914;method_8249()I
      official i Ldfg;i()I
    • resetUses Link icon

      public void resetUses()
      Resets the number of times this trade offer has been used.
      Mappings:
      Namespace Name Mixin selector
      named resetUses Lnet/minecraft/village/TradeOffer;resetUses()V
      intermediary method_19275 Lnet/minecraft/class_1914;method_19275()V
      official j Ldfg;j()V
    • getMaxUses Link icon

      public int getMaxUses()
      Returns the maximum number of times this trade offer can be used.
      Mappings:
      Namespace Name Mixin selector
      named getMaxUses Lnet/minecraft/village/TradeOffer;getMaxUses()I
      intermediary method_8248 Lnet/minecraft/class_1914;method_8248()I
      official k Ldfg;k()I
    • use Link icon

      public void use()
      Increments the number of times this trade offer has been used.
      Mappings:
      Namespace Name Mixin selector
      named use Lnet/minecraft/village/TradeOffer;use()V
      intermediary method_8244 Lnet/minecraft/class_1914;method_8244()V
      official l Ldfg;l()V
    • getDemandBonus Link icon

      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 getDemandBonus Lnet/minecraft/village/TradeOffer;getDemandBonus()I
      intermediary method_21725 Lnet/minecraft/class_1914;method_21725()I
      official m Ldfg;m()I
    • increaseSpecialPrice Link icon

      public void increaseSpecialPrice(int increment)
      Increases the special price of this trade offer by increment.

      A negative increment value will decrease the special price.

      Mappings:
      Namespace Name Mixin selector
      named increaseSpecialPrice Lnet/minecraft/village/TradeOffer;increaseSpecialPrice(I)V
      intermediary method_8245 Lnet/minecraft/class_1914;method_8245(I)V
      official a Ldfg;a(I)V
    • clearSpecialPrice Link icon

      public void clearSpecialPrice()
      Resets the special price of this trade offer.
      Mappings:
      Namespace Name Mixin selector
      named clearSpecialPrice Lnet/minecraft/village/TradeOffer;clearSpecialPrice()V
      intermediary method_19276 Lnet/minecraft/class_1914;method_19276()V
      official n Ldfg;n()V
    • getSpecialPrice Link icon

      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 getSpecialPrice Lnet/minecraft/village/TradeOffer;getSpecialPrice()I
      intermediary method_19277 Lnet/minecraft/class_1914;method_19277()I
      official o Ldfg;o()I
    • setSpecialPrice Link icon

      public void setSpecialPrice(int specialPrice)
      Sets the special price of this trade offer to specialPrice.
      Mappings:
      Namespace Name Mixin selector
      named setSpecialPrice Lnet/minecraft/village/TradeOffer;setSpecialPrice(I)V
      intermediary method_19273 Lnet/minecraft/class_1914;method_19273(I)V
      official b Ldfg;b(I)V
    • getPriceMultiplier Link icon

      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 getPriceMultiplier Lnet/minecraft/village/TradeOffer;getPriceMultiplier()F
      intermediary method_19278 Lnet/minecraft/class_1914;method_19278()F
      official p Ldfg;p()F
    • getMerchantExperience Link icon

      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 getMerchantExperience Lnet/minecraft/village/TradeOffer;getMerchantExperience()I
      intermediary method_19279 Lnet/minecraft/class_1914;method_19279()I
      official q Ldfg;q()I
    • isDisabled Link icon

      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 isDisabled Lnet/minecraft/village/TradeOffer;isDisabled()Z
      intermediary method_8255 Lnet/minecraft/class_1914;method_8255()Z
      official r Ldfg;r()Z
    • disable Link icon

      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 disable Lnet/minecraft/village/TradeOffer;disable()V
      intermediary method_8254 Lnet/minecraft/class_1914;method_8254()V
      official s Ldfg;s()V
    • hasBeenUsed Link icon

      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 hasBeenUsed Lnet/minecraft/village/TradeOffer;hasBeenUsed()Z
      intermediary method_21834 Lnet/minecraft/class_1914;method_21834()Z
      official t Ldfg;t()Z
    • shouldRewardPlayerExperience Link icon

      public boolean shouldRewardPlayerExperience()
      Returns whether experience should be given to a player when they use this trade offer.
      Mappings:
      Namespace Name Mixin selector
      named shouldRewardPlayerExperience Lnet/minecraft/village/TradeOffer;shouldRewardPlayerExperience()Z
      intermediary method_8256 Lnet/minecraft/class_1914;method_8256()Z
      official u Ldfg;u()Z
    • matchesBuyItems Link icon

      public boolean matchesBuyItems(ItemStack stack, ItemStack buyItem)
      Mappings:
      Namespace Name Mixin selector
      named matchesBuyItems Lnet/minecraft/village/TradeOffer;matchesBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
      intermediary method_16952 Lnet/minecraft/class_1914;method_16952(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
      official a Ldfg;a(Lcwq;Lcwq;)Z
    • depleteBuyItems Link icon

      public boolean depleteBuyItems(ItemStack firstBuyStack, ItemStack secondBuyStack)
      Mappings:
      Namespace Name Mixin selector
      named depleteBuyItems Lnet/minecraft/village/TradeOffer;depleteBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
      intermediary method_16953 Lnet/minecraft/class_1914;method_16953(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
      official b Ldfg;b(Lcwq;Lcwq;)Z
    • copy Link icon

      public TradeOffer copy()
      Mappings:
      Namespace Name Mixin selector
      named copy Lnet/minecraft/village/TradeOffer;copy()Lnet/minecraft/village/TradeOffer;
      intermediary method_53881 Lnet/minecraft/class_1914;method_53881()Lnet/minecraft/class_1914;
      official v Ldfg;v()Ldfg;
    • write Link icon

      private static void write(RegistryByteBuf buf, TradeOffer offer)
      Mappings:
      Namespace Name Mixin selector
      named write Lnet/minecraft/village/TradeOffer;write(Lnet/minecraft/network/RegistryByteBuf;Lnet/minecraft/village/TradeOffer;)V
      intermediary method_56111 Lnet/minecraft/class_1914;method_56111(Lnet/minecraft/class_9129;Lnet/minecraft/class_1914;)V
      official a Ldfg;a(Lwa;Ldfg;)V
    • read Link icon

      public static TradeOffer read(RegistryByteBuf buf)
      Mappings:
      Namespace Name Mixin selector
      named read Lnet/minecraft/village/TradeOffer;read(Lnet/minecraft/network/RegistryByteBuf;)Lnet/minecraft/village/TradeOffer;
      intermediary method_56110 Lnet/minecraft/class_1914;method_56110(Lnet/minecraft/class_9129;)Lnet/minecraft/class_1914;
      official a Ldfg;a(Lwa;)Ldfg;