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 Details

    • CODEC

      static final com.mojang.serialization.Codec<IKaryotype> 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

      boolean contains(IChromosome<?> chromosome)
      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

      @Nullable IChromosome<?> getChromosome(net.minecraft.resources.ResourceLocation id)
      Returns:
      The chromosome in this karyotype with the given ID, or null if no such chromosome exists.
    • chromosomeKeyCodec

      com.mojang.serialization.Codec<IChromosome<?>> chromosomeKeyCodec()
      Returns:
      A codec mapping a chromosome ID to its IChromosome in 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

      <V> Allele<V> getDefaultAllele(IChromosome<V> chromosome)
      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

      boolean isWeaklyInherited(IChromosome<?> chromosome)
      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.