Record Class VillagerBuys
java.lang.Object
java.lang.Record
net.darkhax.bookshelf.common.api.entity.villager.trades.VillagerBuys
- Record Components:
stackToBuy- The item being bought by the villager.emeralds- The amount of emeralds to award the player.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 VillagerBuys(Supplier<net.minecraft.world.item.trading.ItemCost> stackToBuy, int emeralds, 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 bought by the villager.
-
Constructor Summary
ConstructorsConstructorDescriptionVillagerBuys(Supplier<net.minecraft.world.item.trading.ItemCost> stackToBuy, int emeralds, int maxUses, int villagerXp, float priceMultiplier) Creates an instance of aVillagerBuysrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintemeralds()Returns the value of theemeraldsrecord component.final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.trading.MerchantOffergetOffer(@NotNull net.minecraft.world.entity.Entity entity, @NotNull net.minecraft.util.RandomSource random) final inthashCode()Returns a hash code value for this object.intmaxUses()Returns the value of themaxUsesrecord component.floatReturns the value of thepriceMultiplierrecord component.Supplier<net.minecraft.world.item.trading.ItemCost> Returns the value of thestackToBuyrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thevillagerXprecord component.
-
Constructor Details
-
VillagerBuys
public VillagerBuys(Supplier<net.minecraft.world.item.trading.ItemCost> stackToBuy, int emeralds, int maxUses, int villagerXp, float priceMultiplier) Creates an instance of aVillagerBuysrecord class.- Parameters:
stackToBuy- the value for thestackToBuyrecord componentemeralds- the value for theemeraldsrecord 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 entity, @NotNull @NotNull net.minecraft.util.RandomSource random) - 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 '=='. -
stackToBuy
Returns the value of thestackToBuyrecord component.- Returns:
- the value of the
stackToBuyrecord component
-
emeralds
public int emeralds()Returns the value of theemeraldsrecord component.- Returns:
- the value of the
emeraldsrecord 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
-