Record Class ITaxon.TaxonAllele

java.lang.Object
java.lang.Record
forestry.api.core.genetics.ITaxon.TaxonAllele
Record Components:
allele - The inline value allele for a data chromosome, or null for a reference chromosome.
reference - The referenced value's ID for a reference chromosome, or null for a data chromosome.
required - Whether members of the taxon are required to have this chromosome.
Enclosing interface:
ITaxon

public static record ITaxon.TaxonAllele(@Nullable Allele<?> allele, @Nullable net.minecraft.resources.ResourceLocation reference, boolean required) extends Record
A default allele associated with a taxon. Exactly one of allele (a data-chromosome value) or reference (a reference-chromosome ID, resolved lazily) is non-null.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TaxonAllele(Allele<?> allele, net.minecraft.resources.ResourceLocation reference, boolean required)
    Creates an instance of a TaxonAllele record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the allele record component.
    data(Allele<?> allele, boolean required)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    net.minecraft.resources.ResourceLocation
    Returns the value of the reference record component.
    reference(net.minecraft.resources.ResourceLocation id, boolean required)
     
    boolean
    Returns the value of the required 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
  • Constructor Details

    • TaxonAllele

      public TaxonAllele(@Nullable Allele<?> allele, @Nullable net.minecraft.resources.ResourceLocation reference, boolean required)
      Creates an instance of a TaxonAllele record class.
      Parameters:
      allele - the value for the allele record component
      reference - the value for the reference record component
      required - the value for the required record component
  • Method Details

    • data

      public static ITaxon.TaxonAllele data(Allele<?> allele, boolean required)
      Returns:
      A taxon default for a data chromosome.
    • reference

      public static ITaxon.TaxonAllele reference(net.minecraft.resources.ResourceLocation id, boolean required)
      Returns:
      A taxon default for a reference chromosome (species, flower type, effect, ...).
    • 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.
    • allele

      @Nullable public Allele<?> allele()
      Returns the value of the allele record component.
      Returns:
      the value of the allele record component
    • reference

      @Nullable public net.minecraft.resources.ResourceLocation reference()
      Returns the value of the reference record component.
      Returns:
      the value of the reference record component
    • required

      public boolean required()
      Returns the value of the required record component.
      Returns:
      the value of the required record component