Package forestry.api.genetics.alleles
Interface IRegistryChromosome<V extends IRegistryAlleleValue>
- All Superinterfaces:
IChromosome<IValueAllele<V>>,IValueChromosome<V>
A chromosome that is backed by a registry of alleles that needs to be populated after karyotypes are created.
In a karyotype, it is not possible to restrict what alleles can be used for a registry chromosome.
Create an instance using
IAlleleManager.registryChromosome(ResourceLocation, Class).-
Method Summary
Modifier and TypeMethodDescriptionalleles()get(net.minecraft.resources.ResourceLocation id) net.minecraft.resources.ResourceLocationGets the allele ID of a value in this chromosome and returns it.getSafe(net.minecraft.resources.ResourceLocation id) booleanbooleanisValidAllele(IAllele allele) Returns whether a certain allele is allowed for this chromosome.voidpopulate(com.google.common.collect.ImmutableMap<net.minecraft.resources.ResourceLocation, V> registry) Used to fill the internal registry of this chromosome.values()Methods inherited from interface forestry.api.genetics.alleles.IChromosome
getChromosomeDisplayName, getChromosomeTranslationKey, getDisplayName, getTranslationKey, id, valueClass
-
Method Details
-
isValidAllele
Returns whether a certain allele is allowed for this chromosome. OverridesIKaryotype.isAlleleValid(forestry.api.genetics.alleles.IChromosome<A>, A).- Returns:
trueif the given allele is valid in this chromosome. Used by the karyotype.
-
get
- Returns:
- The value with the given ID from the registry this chromosome represents.
- Throws:
IllegalStateException- If the registry is not yet populated.RuntimeException- If the registry does not contain an allele with the given ID.
-
getSafe
- Returns:
- The value with the given ID from the registry this chromosome represents, or
nullif the ID is not valid. - Throws:
IllegalStateException- If the registry is not yet populated.
-
values
Collection<V> values()- Returns:
- An immutable collection of all values in this chromosome.
-
alleles
Collection<IRegistryAllele<V>> alleles()- Returns:
- An immutable collection of all alleles in this chromosome.
-
getId
Gets the allele ID of a value in this chromosome and returns it.- Parameters:
value- The value.- Returns:
- The ID of the allele holding this value.
-
populate
void populate(com.google.common.collect.ImmutableMap<net.minecraft.resources.ResourceLocation, V> registry) Used to fill the internal registry of this chromosome.- Parameters:
registry- The immutable map of all registry values.
-
isPopulated
boolean isPopulated()
-