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

    Constructors
    Constructor
    Description
    VillagerBuys(Supplier<net.minecraft.world.item.trading.ItemCost> stackToBuy, int emeralds, int maxUses, int villagerXp, float priceMultiplier)
    Creates an instance of a VillagerBuys record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the emeralds record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.world.item.trading.MerchantOffer
    getOffer(@NotNull net.minecraft.world.entity.Entity entity, @NotNull net.minecraft.util.RandomSource random)
     
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the maxUses record component.
    float
    Returns the value of the priceMultiplier record component.
    Supplier<net.minecraft.world.item.trading.ItemCost>
    Returns the value of the stackToBuy record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the villagerXp record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a VillagerBuys record class.
      Parameters:
      stackToBuy - the value for the stackToBuy record component
      emeralds - the value for the emeralds record component
      maxUses - the value for the maxUses record component
      villagerXp - the value for the villagerXp record component
      priceMultiplier - the value for the priceMultiplier record 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:
      getOffer in interface net.minecraft.world.entity.npc.VillagerTrades.ItemListing
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • stackToBuy

      public Supplier<net.minecraft.world.item.trading.ItemCost> stackToBuy()
      Returns the value of the stackToBuy record component.
      Returns:
      the value of the stackToBuy record component
    • emeralds

      public int emeralds()
      Returns the value of the emeralds record component.
      Returns:
      the value of the emeralds record component
    • maxUses

      public int maxUses()
      Returns the value of the maxUses record component.
      Returns:
      the value of the maxUses record component
    • villagerXp

      public int villagerXp()
      Returns the value of the villagerXp record component.
      Returns:
      the value of the villagerXp record component
    • priceMultiplier

      public float priceMultiplier()
      Returns the value of the priceMultiplier record component.
      Returns:
      the value of the priceMultiplier record component