Package net.minecraft.village
Class TradeOffer
java.lang.Object
net.minecraft.village.TradeOffer
- Mappings:
Namespace Name official clk
intermediary net/minecraft/class_1914
named net/minecraft/village/TradeOffer
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTradeOffer
(ItemStack buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) TradeOffer
(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) TradeOffer
(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier) TradeOffer
(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) TradeOffer
(NbtCompound nbt) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
acceptsBuy
(ItemStack given, ItemStack sample) void
Resets the special price of this trade offer.Returns a copy of the sell item of this trade offer.boolean
depleteBuyItems
(ItemStack firstBuyStack, ItemStack secondBuyStack) void
disable()
Sets the number of times this trade offer has been used to its maximum uses, making it disabled.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.int
Returns the demand bonus of this trade offer.int
Returns the maximum number of times this trade offer can be used.int
Returns 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.float
Returns the price multiplier of this trade offer.Returns the second buy item of this trade offer.Returns the sell item of this trade offer.int
Returns the special price of this trade offer.int
getUses()
Returns the number of times this trade offer has been used.boolean
Returns whether this trade offer has already been used.void
increaseSpecialPrice
(int increment) Increases the special price of this trade offer byincrement
.boolean
Returns whether this trade offer is disabled.boolean
matchesBuyItems
(ItemStack first, ItemStack second) void
Resets the number of times this trade offer has been used.void
setSpecialPrice
(int specialPrice) Sets the special price of this trade offer tospecialPrice
.boolean
Returns whether experience should be given to a player when they use this trade offer.toNbt()
void
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.void
use()
Increments the number of times this trade offer has been used.
-
Field Details
-
firstBuyItem
- Mappings:
Namespace Name Mixin selector official a
Lclk;a:Lcfz;
intermediary field_9146
Lnet/minecraft/class_1914;field_9146:Lnet/minecraft/class_1799;
named firstBuyItem
Lnet/minecraft/village/TradeOffer;firstBuyItem:Lnet/minecraft/item/ItemStack;
-
secondBuyItem
- Mappings:
Namespace Name Mixin selector official b
Lclk;b:Lcfz;
intermediary field_9143
Lnet/minecraft/class_1914;field_9143:Lnet/minecraft/class_1799;
named secondBuyItem
Lnet/minecraft/village/TradeOffer;secondBuyItem:Lnet/minecraft/item/ItemStack;
-
sellItem
- Mappings:
Namespace Name Mixin selector official c
Lclk;c:Lcfz;
intermediary field_9148
Lnet/minecraft/class_1914;field_9148:Lnet/minecraft/class_1799;
named sellItem
Lnet/minecraft/village/TradeOffer;sellItem:Lnet/minecraft/item/ItemStack;
-
uses
private int uses- Mappings:
Namespace Name Mixin selector official d
Lclk;d:I
intermediary field_9147
Lnet/minecraft/class_1914;field_9147:I
named uses
Lnet/minecraft/village/TradeOffer;uses:I
-
maxUses
private final int maxUses- Mappings:
Namespace Name Mixin selector official e
Lclk;e:I
intermediary field_9144
Lnet/minecraft/class_1914;field_9144:I
named maxUses
Lnet/minecraft/village/TradeOffer;maxUses:I
-
rewardingPlayerExperience
private boolean rewardingPlayerExperience- Mappings:
Namespace Name Mixin selector official f
Lclk;f:Z
intermediary field_9145
Lnet/minecraft/class_1914;field_9145:Z
named rewardingPlayerExperience
Lnet/minecraft/village/TradeOffer;rewardingPlayerExperience:Z
-
specialPrice
private int specialPrice- Mappings:
Namespace Name Mixin selector official g
Lclk;g:I
intermediary field_18676
Lnet/minecraft/class_1914;field_18676:I
named specialPrice
Lnet/minecraft/village/TradeOffer;specialPrice:I
-
demandBonus
private int demandBonus- Mappings:
Namespace Name Mixin selector official h
Lclk;h:I
intermediary field_18677
Lnet/minecraft/class_1914;field_18677:I
named demandBonus
Lnet/minecraft/village/TradeOffer;demandBonus:I
-
priceMultiplier
private float priceMultiplier- Mappings:
Namespace Name Mixin selector official i
Lclk;i:F
intermediary field_18678
Lnet/minecraft/class_1914;field_18678:F
named priceMultiplier
Lnet/minecraft/village/TradeOffer;priceMultiplier:F
-
merchantExperience
private int merchantExperience- Mappings:
Namespace Name Mixin selector official j
Lclk;j:I
intermediary field_18679
Lnet/minecraft/class_1914;field_18679:I
named merchantExperience
Lnet/minecraft/village/TradeOffer;merchantExperience:I
-
-
Constructor Details
-
TradeOffer
- Mappings:
Namespace Name Mixin selector official <init>
Lclk;<init>(Lqr;)V
intermediary <init>
Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_2487;)V
named <init>
Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/nbt/NbtCompound;)V
-
TradeOffer
public TradeOffer(ItemStack buyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector official <init>
Lclk;<init>(Lcfz;Lcfz;IIF)V
intermediary <init>
Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;IIF)V
named <init>
Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;IIF)V
-
TradeOffer
public TradeOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector official <init>
Lclk;<init>(Lcfz;Lcfz;Lcfz;IIF)V
intermediary <init>
Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;IIF)V
named <init>
Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;IIF)V
-
TradeOffer
public TradeOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier) - Mappings:
Namespace Name Mixin selector official <init>
Lclk;<init>(Lcfz;Lcfz;Lcfz;IIIF)V
intermediary <init>
Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;IIIF)V
named <init>
Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;IIIF)V
-
TradeOffer
public TradeOffer(ItemStack firstBuyItem, ItemStack secondBuyItem, ItemStack sellItem, int uses, int maxUses, int merchantExperience, float priceMultiplier, int demandBonus) - Mappings:
Namespace Name Mixin selector official <init>
Lclk;<init>(Lcfz;Lcfz;Lcfz;IIIFI)V
intermediary <init>
Lnet/minecraft/class_1914;<init>(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;IIIFI)V
named <init>
Lnet/minecraft/village/TradeOffer;<init>(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;IIIFI)V
-
-
Method Details
-
getOriginalFirstBuyItem
Returns the first buy item of this trade offer.- Mappings:
Namespace Name Mixin selector official a
Lclk;a()Lcfz;
intermediary method_8246
Lnet/minecraft/class_1914;method_8246()Lnet/minecraft/class_1799;
named getOriginalFirstBuyItem
Lnet/minecraft/village/TradeOffer;getOriginalFirstBuyItem()Lnet/minecraft/item/ItemStack;
-
getAdjustedFirstBuyItem
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 b
Lclk;b()Lcfz;
intermediary method_19272
Lnet/minecraft/class_1914;method_19272()Lnet/minecraft/class_1799;
named getAdjustedFirstBuyItem
Lnet/minecraft/village/TradeOffer;getAdjustedFirstBuyItem()Lnet/minecraft/item/ItemStack;
-
getSecondBuyItem
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 c
Lclk;c()Lcfz;
intermediary method_8247
Lnet/minecraft/class_1914;method_8247()Lnet/minecraft/class_1799;
named getSecondBuyItem
Lnet/minecraft/village/TradeOffer;getSecondBuyItem()Lnet/minecraft/item/ItemStack;
-
getSellItem
Returns the sell item of this trade offer.- Mappings:
Namespace Name Mixin selector official d
Lclk;d()Lcfz;
intermediary method_8250
Lnet/minecraft/class_1914;method_8250()Lnet/minecraft/class_1799;
named getSellItem
Lnet/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 e
Lclk;e()V
intermediary method_19274
Lnet/minecraft/class_1914;method_19274()V
named updateDemandBonus
Lnet/minecraft/village/TradeOffer;updateDemandBonus()V
-
copySellItem
Returns a copy of the sell item of this trade offer.- Mappings:
Namespace Name Mixin selector official f
Lclk;f()Lcfz;
intermediary method_18019
Lnet/minecraft/class_1914;method_18019()Lnet/minecraft/class_1799;
named copySellItem
Lnet/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 g
Lclk;g()I
intermediary method_8249
Lnet/minecraft/class_1914;method_8249()I
named getUses
Lnet/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 h
Lclk;h()V
intermediary method_19275
Lnet/minecraft/class_1914;method_19275()V
named resetUses
Lnet/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 i
Lclk;i()I
intermediary method_8248
Lnet/minecraft/class_1914;method_8248()I
named getMaxUses
Lnet/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 j
Lclk;j()V
intermediary method_8244
Lnet/minecraft/class_1914;method_8244()V
named use
Lnet/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 k
Lclk;k()I
intermediary method_21725
Lnet/minecraft/class_1914;method_21725()I
named getDemandBonus
Lnet/minecraft/village/TradeOffer;getDemandBonus()I
-
increaseSpecialPrice
public void increaseSpecialPrice(int increment) Increases the special price of this trade offer byincrement
.A negative
increment
value will decrease the special price.- Mappings:
Namespace Name Mixin selector official a
Lclk;a(I)V
intermediary method_8245
Lnet/minecraft/class_1914;method_8245(I)V
named increaseSpecialPrice
Lnet/minecraft/village/TradeOffer;increaseSpecialPrice(I)V
-
clearSpecialPrice
public void clearSpecialPrice()Resets the special price of this trade offer.- Mappings:
Namespace Name Mixin selector official l
Lclk;l()V
intermediary method_19276
Lnet/minecraft/class_1914;method_19276()V
named clearSpecialPrice
Lnet/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 m
Lclk;m()I
intermediary method_19277
Lnet/minecraft/class_1914;method_19277()I
named getSpecialPrice
Lnet/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 b
Lclk;b(I)V
intermediary method_19273
Lnet/minecraft/class_1914;method_19273(I)V
named setSpecialPrice
Lnet/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 n
Lclk;n()F
intermediary method_19278
Lnet/minecraft/class_1914;method_19278()F
named getPriceMultiplier
Lnet/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 o
Lclk;o()I
intermediary method_19279
Lnet/minecraft/class_1914;method_19279()I
named getMerchantExperience
Lnet/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 p
Lclk;p()Z
intermediary method_8255
Lnet/minecraft/class_1914;method_8255()Z
named isDisabled
Lnet/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 q
Lclk;q()V
intermediary method_8254
Lnet/minecraft/class_1914;method_8254()V
named disable
Lnet/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 r
Lclk;r()Z
intermediary method_21834
Lnet/minecraft/class_1914;method_21834()Z
named hasBeenUsed
Lnet/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 s
Lclk;s()Z
intermediary method_8256
Lnet/minecraft/class_1914;method_8256()Z
named shouldRewardPlayerExperience
Lnet/minecraft/village/TradeOffer;shouldRewardPlayerExperience()Z
-
toNbt
- Mappings:
Namespace Name Mixin selector official t
Lclk;t()Lqr;
intermediary method_8251
Lnet/minecraft/class_1914;method_8251()Lnet/minecraft/class_2487;
named toNbt
Lnet/minecraft/village/TradeOffer;toNbt()Lnet/minecraft/nbt/NbtCompound;
-
matchesBuyItems
- Mappings:
Namespace Name Mixin selector official a
Lclk;a(Lcfz;Lcfz;)Z
intermediary method_16952
Lnet/minecraft/class_1914;method_16952(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
named matchesBuyItems
Lnet/minecraft/village/TradeOffer;matchesBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
acceptsBuy
- Mappings:
Namespace Name Mixin selector official c
Lclk;c(Lcfz;Lcfz;)Z
intermediary method_16954
Lnet/minecraft/class_1914;method_16954(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
named acceptsBuy
Lnet/minecraft/village/TradeOffer;acceptsBuy(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
depleteBuyItems
- Mappings:
Namespace Name Mixin selector official b
Lclk;b(Lcfz;Lcfz;)Z
intermediary method_16953
Lnet/minecraft/class_1914;method_16953(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
named depleteBuyItems
Lnet/minecraft/village/TradeOffer;depleteBuyItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-