Record Class VillagerSells
java.lang.Object
java.lang.Record
net.darkhax.bookshelf.common.api.entity.villager.trades.VillagerSells
- Record Components:
itemToBuy- The item being sold by the villager.emeraldCost- The amount of emeralds the trade will cost.maxUses- The amount of times the trade can be performed before a restocking is required.villagerXp- The amount of villager XP to award for performing the trade.priceMultiplier- A price multiplier.
- All Implemented Interfaces:
net.minecraft.world.entity.npc.VillagerTrades.ItemListing
public record VillagerSells(Supplier<net.minecraft.world.item.ItemStack> itemToBuy, int emeraldCost, int maxUses, int villagerXp, float priceMultiplier)
extends Record
implements net.minecraft.world.entity.npc.VillagerTrades.ItemListing
A simple villager trade entry that represents an item being sold to the player.
-
Constructor Summary
ConstructorsConstructorDescriptionVillagerSells(Supplier<net.minecraft.world.item.ItemStack> itemToBuy, int emeraldCost, int maxUses, int villagerXp, float priceMultiplier) Creates an instance of aVillagerSellsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theemeraldCostrecord component.final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.trading.MerchantOffergetOffer(@NotNull net.minecraft.world.entity.Entity villager, @NotNull net.minecraft.util.RandomSource rng) final inthashCode()Returns a hash code value for this object.Supplier<net.minecraft.world.item.ItemStack> Returns the value of theitemToBuyrecord component.intmaxUses()Returns the value of themaxUsesrecord component.floatReturns the value of thepriceMultiplierrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thevillagerXprecord component.
-
Constructor Details
-
VillagerSells
public VillagerSells(Supplier<net.minecraft.world.item.ItemStack> itemToBuy, int emeraldCost, int maxUses, int villagerXp, float priceMultiplier) Creates an instance of aVillagerSellsrecord class.- Parameters:
itemToBuy- the value for theitemToBuyrecord componentemeraldCost- the value for theemeraldCostrecord componentmaxUses- the value for themaxUsesrecord componentvillagerXp- the value for thevillagerXprecord componentpriceMultiplier- the value for thepriceMultiplierrecord component
-
-
Method Details
-
getOffer
public net.minecraft.world.item.trading.MerchantOffer getOffer(@NotNull @NotNull net.minecraft.world.entity.Entity villager, @NotNull @NotNull net.minecraft.util.RandomSource rng) - Specified by:
getOfferin interfacenet.minecraft.world.entity.npc.VillagerTrades.ItemListing
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
itemToBuy
Returns the value of theitemToBuyrecord component.- Returns:
- the value of the
itemToBuyrecord component
-
emeraldCost
public int emeraldCost()Returns the value of theemeraldCostrecord component.- Returns:
- the value of the
emeraldCostrecord component
-
maxUses
public int maxUses()Returns the value of themaxUsesrecord component.- Returns:
- the value of the
maxUsesrecord component
-
villagerXp
public int villagerXp()Returns the value of thevillagerXprecord component.- Returns:
- the value of the
villagerXprecord component
-
priceMultiplier
public float priceMultiplier()Returns the value of thepriceMultiplierrecord component.- Returns:
- the value of the
priceMultiplierrecord component
-