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 dbs
  • Field Details

    • CODEC

      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 Ldbs;a:Lcom/mojang/serialization/Codec;
    • PACKET_CODEC

      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 Ldbs;b:Lyw;
    • firstBuyItem

      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 Ldbs;c:Ldbq;
    • secondBuyItem

      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 Ldbs;d:Ljava/util/Optional;
    • sellItem

      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 Ldbs;e:Lcuo;
    • uses

      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 Ldbs;f:I
    • maxUses

      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 Ldbs;g:I
    • rewardingPlayerExperience

      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 Ldbs;h:Z
    • specialPrice

      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 Ldbs;i:I
    • demandBonus

      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 Ldbs;j:I
    • priceMultiplier

      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 Ldbs;k:F
    • merchantExperience

      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 Ldbs;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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIZIIFI)V
      official <init> Ldbs;<init>(Ldbq;Ljava/util/Optional;Lcuo;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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Lnet/minecraft/class_1799;IIF)V
      official <init> Ldbs;<init>(Ldbq;Lcuo;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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIF)V
      official <init> Ldbs;<init>(Ldbq;Ljava/util/Optional;Lcuo;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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIF)V
      official <init> Ldbs;<init>(Ldbq;Ljava/util/Optional;Lcuo;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)V
      intermediary <init> Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_9306;Ljava/util/Optional;Lnet/minecraft/class_1799;IIIFI)V
      official <init> Ldbs;<init>(Ldbq;Ljava/util/Optional;Lcuo;IIIFI)V
    • TradeOffer

      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> Ldbs;<init>(Ldbs;)V
  • Method Details

    • getOriginalFirstBuyItem

      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 Ldbs;a()Lcuo;
    • getDisplayedFirstBuyItem

      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 Ldbs;b()Lcuo;
    • getFirstBuyItemCount

      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 Ldbs;a(Ldbq;)I
    • getDisplayedSecondBuyItem

      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 Ldbs;c()Lcuo;
    • getFirstBuyItem

      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 Ldbs;d()Ldbq;
    • getSecondBuyItem

      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 Ldbs;e()Ljava/util/Optional;
    • getSellItem

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

      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 Ldbs;h()Lcuo;
    • getUses

      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 Ldbs;i()I
    • resetUses

      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 Ldbs;j()V
    • getMaxUses

      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 Ldbs;k()I
    • use

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

      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 Ldbs;a(I)V
    • clearSpecialPrice

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

      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 Ldbs;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 getPriceMultiplier Lnet/minecraft/village/TradeOffer;getPriceMultiplier()F
      intermediary method_19278 Lnet/minecraft/class_1914;method_19278()F
      official p Ldbs;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 getMerchantExperience Lnet/minecraft/village/TradeOffer;getMerchantExperience()I
      intermediary method_19279 Lnet/minecraft/class_1914;method_19279()I
      official q Ldbs;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 isDisabled Lnet/minecraft/village/TradeOffer;isDisabled()Z
      intermediary method_8255 Lnet/minecraft/class_1914;method_8255()Z
      official r Ldbs;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 disable Lnet/minecraft/village/TradeOffer;disable()V
      intermediary method_8254 Lnet/minecraft/class_1914;method_8254()V
      official s Ldbs;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 hasBeenUsed Lnet/minecraft/village/TradeOffer;hasBeenUsed()Z
      intermediary method_21834 Lnet/minecraft/class_1914;method_21834()Z
      official t Ldbs;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 shouldRewardPlayerExperience Lnet/minecraft/village/TradeOffer;shouldRewardPlayerExperience()Z
      intermediary method_8256 Lnet/minecraft/class_1914;method_8256()Z
      official u Ldbs;u()Z
    • matchesBuyItems

      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 Ldbs;a(Lcuo;Lcuo;)Z
    • depleteBuyItems

      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 Ldbs;b(Lcuo;Lcuo;)Z
    • copy

      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 Ldbs;v()Ldbs;
    • write

      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 Ldbs;a(Lwj;Ldbs;)V
    • read

      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 Ldbs;a(Lwj;)Ldbs;