Record Class TradeItem

java.lang.Object
java.lang.Record
api.entity.mob.villager.TradeItem

public record TradeItem(int id, int metadata, int minCount, int maxCount) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TradeItem
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TradeItem(int id, int metadata, int minCount, int maxCount)
    Creates an instance of a TradeItem record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    static TradeItem
    fromID(int id)
     
    static TradeItem
    fromID(int id, int count)
     
    static TradeItem
    fromID(int id, int minCount, int maxCount)
     
    static TradeItem
    fromIDAndMetadata(int id, int metadata)
     
    static TradeItem
    fromIDAndMetadata(int id, int metadata, int count)
     
    static TradeItem
    fromIDAndMetadata(int id, int metadata, int minCount, int maxCount)
     
    final int
    Returns a hash code value for this object.
    int
    id()
    Returns the value of the id record component.
    boolean
     
    int
    Returns the value of the maxCount record component.
    int
    Returns the value of the metadata record component.
    int
    Returns the value of the minCount record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      public static final TradeItem EMPTY
  • Constructor Details

    • TradeItem

      public TradeItem(int id, int metadata, int minCount, int maxCount)
      Creates an instance of a TradeItem record class.
      Parameters:
      id - the value for the id record component
      metadata - the value for the metadata record component
      minCount - the value for the minCount record component
      maxCount - the value for the maxCount record component
  • Method Details

    • fromID

      public static TradeItem fromID(int id)
    • fromID

      public static TradeItem fromID(int id, int count)
    • fromID

      public static TradeItem fromID(int id, int minCount, int maxCount)
    • fromIDAndMetadata

      public static TradeItem fromIDAndMetadata(int id, int metadata)
    • fromIDAndMetadata

      public static TradeItem fromIDAndMetadata(int id, int metadata, int count)
    • fromIDAndMetadata

      public static TradeItem fromIDAndMetadata(int id, int metadata, int minCount, int maxCount)
    • isEmpty

      public boolean isEmpty()
    • 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 '=='.
      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.
    • id

      public int id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • metadata

      public int metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component
    • minCount

      public int minCount()
      Returns the value of the minCount record component.
      Returns:
      the value of the minCount record component
    • maxCount

      public int maxCount()
      Returns the value of the maxCount record component.
      Returns:
      the value of the maxCount record component