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 dbe
  • 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 Ldbe;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 Ldbe;b:Lys;
    • 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 Ldbe;c:Ldbc;
    • 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 Ldbe;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 Ldbe;e:Lcud;
    • 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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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> Ldbe;<init>(Ldbc;Ljava/util/Optional;Lcud;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> Ldbe;<init>(Ldbc;Lcud;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> Ldbe;<init>(Ldbc;Ljava/util/Optional;Lcud;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> Ldbe;<init>(Ldbc;Ljava/util/Optional;Lcud;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> Ldbe;<init>(Ldbc;Ljava/util/Optional;Lcud;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> Ldbe;<init>(Ldbe;)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 Ldbe;a()Lcud;
    • 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 Ldbe;b()Lcud;
    • 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 Ldbe;a(Ldbc;)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 Ldbe;c()Lcud;
    • 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 Ldbe;d()Ldbc;
    • 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 Ldbe;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 Ldbe;f()Lcud;
    • 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 Ldbe;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 Ldbe;h()Lcud;
    • 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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;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 Ldbe;a(Lcud;Lcud;)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 Ldbe;b(Lcud;Lcud;)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 Ldbe;v()Ldbe;
    • 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 Ldbe;a(Lwf;Ldbe;)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 Ldbe;a(Lwf;)Ldbe;