Interface IGeneticManager


public interface IGeneticManager
Home to all things genetics. Keeps track of registered species types, which track all their registered member species and are responsible for creating instances of IIndividual and ItemStack. Keeps track of all taxonomy, breeding trackers, and mutations.
  • Method Details

    • getTaxon

      ITaxon getTaxon(String name)
      Returns:
      The taxon instance with the given (lowercase) name. See ForestryTaxa for all names used by base Forestry.
      Throws:
      IllegalArgumentException - If no taxon was registered with that name.
    • getParentTaxa

      ITaxon[] getParentTaxa(String name)
      Returns a list containing this taxon and its parents in order of taxonomic rank. See TaxonomicRank.
      Parameters:
      name - The name of the taxon whose parent taxa to retrieve.
      Returns:
      A list containing this taxon and its parents in order of taxonomic rank.
    • getMutations

      <S extends ISpecies<?>> IMutationManager<S> getMutations(ISpeciesType<?,?> speciesType)
      Retrieves the registry of possible mutations for a given species type. Register mutations using a IForestryPlugin.
      Parameters:
      speciesType - The species type.
      Returns:
      A registry of possible mutations for the given species type.
      Throws:
      IllegalStateException - If mutations have not been registered yet.
    • getMutations

      default <S extends ISpecies<?>> IMutationManager<S> getMutations(net.minecraft.resources.ResourceLocation speciesTypeId)
    • getSpeciesType

      ISpeciesType<?,?> getSpeciesType(net.minecraft.resources.ResourceLocation speciesTypeId)
      Gets a registered species type by its ID. Use ISpeciesType.cast() to get the desired type.
      Returns:
      The ISpeciesType with the given ID.
      Throws:
      IllegalArgumentException - If no species type was found with that ID.
    • getSpeciesTypeSafe

      @Nullable ISpeciesType<?,?> getSpeciesTypeSafe(net.minecraft.resources.ResourceLocation speciesTypeId)
      Gets a registered species type by its ID, or returns null if no species type was found.
      Returns:
      The ISpeciesType with the given ID, or null if no species type was registered with that ID.
    • getSpeciesType

      default <T extends ISpeciesType<?, ?>> T getSpeciesType(net.minecraft.resources.ResourceLocation speciesTypeId, Class<T> typeClass)
      Returns:
      The ISpeciesType with the given ID and type.
      Throws:
      IllegalArgumentException - If no species type was found with that ID.
    • createDefaultIndividual

      default <I extends IIndividual> I createDefaultIndividual(net.minecraft.resources.ResourceLocation typeId)
      Creates a new individual using the default genome of the given species type.
      Type Parameters:
      I - The generic type of individual. Unchecked cast.
      Parameters:
      typeId - The ID of the species type to create an individual for.
      Returns:
      The new individual with a default genome.
    • getSpeciesTypes

      Collection<ISpeciesType<?,?>> getSpeciesTypes()
      Returns:
      A collection of all registered species types.