Interface IKaryotype
public interface IKaryotype
A karyotype is the set of all chromosomes that make up a species type's genome.
It defines the chromosome list, each chromosome's default allele, and the genome codecs.
Genomes serialize their allele values inline via each chromosome's value codec, so no global allele registry exists.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<IChromosome<?>> booleancontains(IChromosome<?> chromosome) Checks if this karyotype contains the given chromosome.IChromosome<?> getChromosome(net.minecraft.resources.ResourceLocation id) com.google.common.collect.ImmutableList<IChromosome<?>> <V> Allele<V> getDefaultAllele(IChromosome<V> chromosome) com.google.common.collect.ImmutableMap<IChromosome<?>, Allele<?>> net.minecraft.resources.ResourceLocationcom.mojang.serialization.Codec<IGenome> net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, IGenome> IChromosome<net.minecraft.resources.ResourceLocation> net.minecraft.resources.ResourceLocationid()booleanisWeaklyInherited(IChromosome<?> chromosome) A weakly inherited chromosome's default allele is always overridden by non-default alleles during inheritance (e.g.intsize()
-
Field Details
-
CODEC
-
-
Method Details
-
id
net.minecraft.resources.ResourceLocation id()- Returns:
- The stable ID used to serialize this karyotype.
-
getChromosomes
com.google.common.collect.ImmutableList<IChromosome<?>> getChromosomes()- Returns:
- All chromosome types of this karyotype, in the order they were defined.
-
contains
Checks if this karyotype contains the given chromosome. This is the only membership/validity check; any value of the correct type is permitted for a chromosome (validity is permissive). -
getSpeciesChromosome
IChromosome<net.minecraft.resources.ResourceLocation> getSpeciesChromosome()- Returns:
- The chromosome that determines this individual's species. The genome stores the species' ID.
-
getChromosome
- Returns:
- The chromosome in this karyotype with the given ID, or
nullif no such chromosome exists.
-
chromosomeKeyCodec
com.mojang.serialization.Codec<IChromosome<?>> chromosomeKeyCodec()- Returns:
- A codec mapping a chromosome ID to its
IChromosomein this karyotype, erroring on unknown IDs. Used as the key codec for genome and mutation-result dispatched maps.
-
size
int size()- Returns:
- The number of chromosomes in this karyotype.
-
getDefaultAllele
- Returns:
- The default allele for the given chromosome in this karyotype. For reference chromosomes this is resolved lazily (after registries are populated).
-
getDefaultAlleles
com.google.common.collect.ImmutableMap<IChromosome<?>,Allele<?>> getDefaultAlleles()- Returns:
- A map of every chromosome to its default allele. Resolved lazily for reference chromosomes.
-
isWeaklyInherited
A weakly inherited chromosome's default allele is always overridden by non-default alleles during inheritance (e.g. a bee's temperature tolerance). -
getDefaultSpecies
net.minecraft.resources.ResourceLocation getDefaultSpecies()- Returns:
- The default species ID for this species type.
-
getGenomeCodec
com.mojang.serialization.Codec<IGenome> getGenomeCodec()- Returns:
- The codec used to serialize/deserialize genomes of this karyotype (values stored inline).
-
getGenomeStreamCodec
net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,IGenome> getGenomeStreamCodec()- Returns:
- The stream codec used to sync genomes of this karyotype over the network.
-
createGenomeBuilder
IGenomeBuilder createGenomeBuilder()- Returns:
- A new genome builder using this karyotype.
-