Package forestry.api.core.genetics
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault IGenomecopyWith(Map<IChromosome<?>, Allele<?>> alleles) Copies this genome, setting both alleles of each given chromosome to the given value.copyWithPairs(Map<IChromosome<?>, AllelePair<?>> allelePairs) Copies this genome, replacing allele pairs from the given map.default <V> Allele<V> getActiveAllele(IChromosome<V> chromosome) default <S extends ISpecies<?>>
SNote: UseIIndividual.getSpecies()whenever possible.default <V> VgetActiveValue(IChromosome<V> chromosome) <V> AllelePair<V> getAllelePair(IChromosome<V> chromosome) com.google.common.collect.ImmutableList<AllelePair<?>> com.google.common.collect.ImmutableMap<IChromosome<?>, AllelePair<?>> default <V> Allele<V> getInactiveAllele(IChromosome<V> chromosome) default <S extends ISpecies<?>>
SNote: UseIIndividual.getInactiveSpecies()whenever possible.default <V> VgetInactiveValue(IChromosome<V> chromosome) booleanbooleanisSameAlleles(IGenome other) default <R> RresolveActive(IChromosome<net.minecraft.resources.ResourceLocation> chromosome) Resolves the active reference value to its behavior object via the chromosome's resolver.default <R> RresolveInactive(IChromosome<net.minecraft.resources.ResourceLocation> chromosome) Resolves the inactive reference value to its behavior object via the chromosome's resolver.
-
Field Details
-
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
- Returns:
- The allele pair for the given chromosome.
-
isDefaultGenome
boolean isDefaultGenome()- Returns:
trueif 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
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 anAllele.reference(net.minecraft.resources.ResourceLocation)value). -
copyWithPairs
Copies this genome, replacing allele pairs from the given map. Returns this genome if nothing changed. -
isSameAlleles
- Returns:
trueif this genome has the same karyotype and alleles as the other genome.
-
getActiveAllele
- Returns:
- The active (expressed) allele of the given chromosome.
-
getInactiveAllele
- Returns:
- The inactive allele of the given chromosome.
-
getActiveValue
- Returns:
- The active value of the given chromosome. For reference chromosomes this is the stored
ResourceLocation; useresolveActive(forestry.api.core.genetics.alleles.IChromosome<net.minecraft.resources.ResourceLocation>)for the behavior object.
-
getInactiveValue
- Returns:
- The inactive value of the given chromosome.
-
resolveActive
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
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
Note: UseIIndividual.getSpecies()whenever possible.- Returns:
- The active species of the individual.
-
getInactiveSpecies
Note: UseIIndividual.getInactiveSpecies()whenever possible.- Returns:
- The inactive species of the individual.
-