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

    • genomeComponent

      net.minecraft.core.component.DataComponentType<IGenome> genomeComponent()
      Returns:
      The data component type that stores an individual's genome on an item stack
    • 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.
    • getTaxonSafe

      @Nullable ITaxon getTaxonSafe(String name)
      Returns:
      The taxon with the given (lowercase) name, or null if none is registered (including datapack taxa that failed to load) — for callers that must degrade gracefully rather than throw, mirroring the datapack-genetics crash-safety of the *Safe species-type getters.
    • 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. Delegates to ISpeciesType.getMutations(); the manager is empty until mutation recipes are loaded.
      Parameters:
      speciesType - The species type.
      Returns:
      A registry of possible mutations for the given species type.
    • 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.