Record Class StructureSet.Entry

java.lang.Object
java.lang.Record
dev.wyck.worldgen.structure.StructureSet.Entry
Record Components:
structure - the structure
weight - the weight the structure is chosen by
Enclosing interface:
StructureSet

@AsOf("3.4.0") public static record StructureSet.Entry(Structure structure, int weight) extends Record
One structure in a set, with the weight it is chosen by when the set holds several.
Since:
3.4.0
  • Constructor Details

    • Entry

      public Entry(Structure structure, int weight)
      Creates an instance of a Entry record class.
      Parameters:
      structure - the value for the structure record component
      weight - the value for the weight record component
  • Method Details

    • of

      @AsOf("3.4.0") public static StructureSet.Entry of(Structure structure, int weight)
      Creates a new entry.
      Parameters:
      structure - the structure
      weight - the weight the structure is chosen by
      Returns:
      a new entry
      Since:
      3.4.0
    • of

      @AsOf("3.4.0") public static StructureSet.Entry of(Structure structure)
      Creates a new entry with a weight of 1.
      Parameters:
      structure - the structure
      Returns:
      a new entry
      Since:
      3.4.0
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • structure

      public Structure structure()
      Returns the value of the structure record component.
      Returns:
      the value of the structure record component
    • weight

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