Record Class VillagerTrades.TypeSpecificTrade

java.lang.Object
java.lang.Record
net.minecraft.world.entity.npc.VillagerTrades.TypeSpecificTrade
All Implemented Interfaces:
VillagerTrades.ItemListing
Enclosing class:
VillagerTrades

static record VillagerTrades.TypeSpecificTrade(Map<VillagerType,VillagerTrades.ItemListing> trades) extends Record implements VillagerTrades.ItemListing
  • Field Details

  • Constructor Details

    • TypeSpecificTrade

      TypeSpecificTrade(Map<VillagerType,VillagerTrades.ItemListing> trades)
      Creates an instance of a TypeSpecificTrade record class.
      Parameters:
      trades - the value for the trades record component
  • Method Details

    • oneTradeInBiomes

      public static VillagerTrades.TypeSpecificTrade oneTradeInBiomes(VillagerTrades.ItemListing p_297877_, VillagerType... p_298107_)
    • getOffer

      @Nullable public MerchantOffer getOffer(Entity p_300790_, RandomSource p_298667_)
      Specified by:
      getOffer in interface 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • trades

      Returns the value of the trades record component.
      Returns:
      the value of the trades record component