Package forestry.api.genetics.alleles
Interface IAlleleManager
public interface IAlleleManager
Used to retrieve interned instances of alleles. Also exposes methods for creating chromosomes.
Store alleles obtained from these method calls in a static class like Forestry does in
ForestryAlleles.
This class is not thread-safe.-
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<IAllele>booleanAllele(boolean value, boolean dominant) booleanChromosome(net.minecraft.resources.ResourceLocation id) com.mojang.serialization.Codec<IChromosome<?>>default IFloatAllelefloatAllele(float value) floatAllele(float value, boolean dominant) floatChromosome(net.minecraft.resources.ResourceLocation id) getAllele(net.minecraft.resources.ResourceLocation id) IChromosome<?>getChromosome(net.minecraft.resources.ResourceLocation id) default IIntegerAlleleintAllele(int value) intAllele(int value, boolean dominant) Creates a new allele for the given value, or retrieves a pre-existing allele if one has already been made.intChromosome(net.minecraft.resources.ResourceLocation id) <V extends IRegistryAlleleValue>
IRegistryAllele<V>registryAllele(net.minecraft.resources.ResourceLocation id, IRegistryChromosome<V> chromosome) <V extends IRegistryAlleleValue>
IRegistryChromosome<V>registryChromosome(net.minecraft.resources.ResourceLocation id, Class<V> valueClass) Creates and registers a registry chromosome, which is responsible for populating the values of its correspondingIRegistryAlleleinstances.<V> IValueAllele<V>valueAllele(V value, boolean dominant, IAlleleNaming<V> naming) default <V> IValueAllele<V>valueAllele(V value, IAlleleNaming<V> naming) <V> IValueChromosome<V>valueChromosome(net.minecraft.resources.ResourceLocation id, Class<V> valueClass)
-
Method Details
-
intAllele
- Returns:
- A recessive integer allele with the given value.
-
intAllele
Creates a new allele for the given value, or retrieves a pre-existing allele if one has already been made.- Parameters:
value- The value of this allele.dominant- If this allele is dominant.- Returns:
- A new allele, or an existing one if this allele has already been created elsewhere.
-
floatAllele
-
floatAllele
-
valueAllele
-
valueAllele
-
booleanAllele
- Returns:
- A new boolean allele.
-
registryAllele
<V extends IRegistryAlleleValue> IRegistryAllele<V> registryAllele(net.minecraft.resources.ResourceLocation id, IRegistryChromosome<V> chromosome) -
alleleCodec
com.mojang.serialization.Codec<IAllele> alleleCodec()- Returns:
- The allele codec, which serializes/deserializes using the allele's ID.
-
chromosomeCodec
com.mojang.serialization.Codec<IChromosome<?>> chromosomeCodec()- Returns:
- The chromosome codec, which serializes/deserializes using the chromosome's ID.
-
getAllele
- Returns:
- An allele with the given ID, or
nullif no allele has been created with that ID.
-
floatChromosome
-
intChromosome
-
booleanChromosome
-
valueChromosome
<V> IValueChromosome<V> valueChromosome(net.minecraft.resources.ResourceLocation id, Class<V> valueClass) -
registryChromosome
<V extends IRegistryAlleleValue> IRegistryChromosome<V> registryChromosome(net.minecraft.resources.ResourceLocation id, Class<V> valueClass) Creates and registers a registry chromosome, which is responsible for populating the values of its correspondingIRegistryAlleleinstances.- Type Parameters:
V- The type of value contained by the alleles of this chromosome.- Parameters:
id- The ID of this chromosome.valueClass- The type of value this chromosome's alleles hold. Must implementIRegistryAlleleValue.- Returns:
- A new registry chromosome.
-
getChromosome
- Returns:
- A chromosome with the given ID, or
nullif no chromosome has been created with that ID. - Since:
- 2.1.1
-