Interface IRegistryChromosome<V extends IRegistryAlleleValue>

All Superinterfaces:
IChromosome<IValueAllele<V>>, IValueChromosome<V>

public interface IRegistryChromosome<V extends IRegistryAlleleValue> extends 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 Details

    • isValidAllele

      boolean isValidAllele(IAllele allele)
      Returns whether a certain allele is allowed for this chromosome. Overrides IKaryotype.isAlleleValid(forestry.api.genetics.alleles.IChromosome<A>, A).
      Returns:
      true if the given allele is valid in this chromosome. Used by the karyotype.
    • get

      V get(net.minecraft.resources.ResourceLocation id)
      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

      @Nullable V getSafe(net.minecraft.resources.ResourceLocation id)
      Returns:
      The value with the given ID from the registry this chromosome represents, or null if 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

      Returns:
      An immutable collection of all alleles in this chromosome.
    • getId

      net.minecraft.resources.ResourceLocation getId(V value)
      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()