Interface IGenome


public interface IGenome
Holds the AllelePairs which comprise the traits of a given individual. Allele values are stored inline; reference chromosomes (species, flower type, effect, ...) store a ResourceLocation resolved on demand.
  • Field Details

    • CODEC

      static final com.mojang.serialization.Codec<IGenome> CODEC
  • Method Details

    • getAllelePairs

      com.google.common.collect.ImmutableList<AllelePair<?>> getAllelePairs()
      Returns:
      A list with all allele pairs of this genome, in karyotype order.
    • getAllelePair

      <V> AllelePair<V> getAllelePair(IChromosome<V> chromosome)
      Returns:
      The allele pair for the given chromosome.
    • isDefaultGenome

      boolean isDefaultGenome()
      Returns:
      true if this genome equals the default genome of its species.
    • getKaryotype

      IKaryotype getKaryotype()
      Returns:
      The karyotype of this genome.
    • getChromosomes

      com.google.common.collect.ImmutableMap<IChromosome<?>,AllelePair<?>> getChromosomes()
    • copyWith

      default IGenome copyWith(Map<IChromosome<?>,Allele<?>> alleles)
      Copies this genome, setting both alleles of each given chromosome to the given value. For reference chromosomes the value's dominance is intrinsic, so it is resolved from the chromosome's resolver here (ignoring the placeholder dominance of an Allele.reference(net.minecraft.resources.ResourceLocation) value).
    • copyWithPairs

      IGenome copyWithPairs(Map<IChromosome<?>,AllelePair<?>> allelePairs)
      Copies this genome, replacing allele pairs from the given map. Returns this genome if nothing changed.
    • isSameAlleles

      boolean isSameAlleles(IGenome other)
      Returns:
      true if this genome has the same karyotype and alleles as the other genome.
    • getActiveAllele

      default <V> Allele<V> getActiveAllele(IChromosome<V> chromosome)
      Returns:
      The active (expressed) allele of the given chromosome.
    • getInactiveAllele

      default <V> Allele<V> getInactiveAllele(IChromosome<V> chromosome)
      Returns:
      The inactive allele of the given chromosome.
    • getActiveValue

      default <V> V getActiveValue(IChromosome<V> chromosome)
      Returns:
      The active value of the given chromosome. For reference chromosomes this is the stored ResourceLocation; use resolveActive(forestry.api.core.genetics.alleles.IChromosome<net.minecraft.resources.ResourceLocation>) for the behavior object.
    • getInactiveValue

      default <V> V getInactiveValue(IChromosome<V> chromosome)
      Returns:
      The inactive value of the given chromosome.
    • resolveActive

      default <R> R resolveActive(IChromosome<net.minecraft.resources.ResourceLocation> chromosome)
      Resolves the active reference value to its behavior object via the chromosome's resolver.
      Throws:
      NullPointerException - If the chromosome is a data chromosome (has no resolver).
    • resolveInactive

      default <R> R resolveInactive(IChromosome<net.minecraft.resources.ResourceLocation> chromosome)
      Resolves the inactive reference value to its behavior object via the chromosome's resolver.
      Throws:
      NullPointerException - If the chromosome is a data chromosome (has no resolver).
    • getActiveSpecies

      default <S extends ISpecies<?>> S getActiveSpecies()
      Note: Use IIndividual.getSpecies() whenever possible.
      Returns:
      The active species of the individual.
    • getInactiveSpecies

      default <S extends ISpecies<?>> S getInactiveSpecies()
      Note: Use IIndividual.getInactiveSpecies() whenever possible.
      Returns:
      The inactive species of the individual.