Package forestry.api.genetics
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 Summary
Modifier and TypeMethodDescriptiondefault <I extends IIndividual>
IcreateDefaultIndividual(net.minecraft.resources.ResourceLocation typeId) Creates a new individual using the default genome of the given species type.<S extends ISpecies<?>>
IMutationManager<S>getMutations(ISpeciesType<?, ?> speciesType) Retrieves the registry of possible mutations for a given species type.default <S extends ISpecies<?>>
IMutationManager<S>getMutations(net.minecraft.resources.ResourceLocation speciesTypeId) ITaxon[]getParentTaxa(String name) Returns a list containing this taxon and its parents in order of taxonomic rank.ISpeciesType<?,?> getSpeciesType(net.minecraft.resources.ResourceLocation speciesTypeId) Gets a registered species type by its ID.default <T extends ISpeciesType<?,?>>
TgetSpeciesType(net.minecraft.resources.ResourceLocation speciesTypeId, Class<T> typeClass) Collection<ISpeciesType<?,?>> ISpeciesType<?,?> getSpeciesTypeSafe(net.minecraft.resources.ResourceLocation speciesTypeId) Gets a registered species type by its ID, or returnsnullif no species type was found.
-
Method Details
-
getTaxon
- Returns:
- The taxon instance with the given (lowercase) name. See
ForestryTaxafor all names used by base Forestry. - Throws:
IllegalArgumentException- If no taxon was registered with that name.
-
getParentTaxa
Returns a list containing this taxon and its parents in order of taxonomic rank. SeeTaxonomicRank.- 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
Retrieves the registry of possible mutations for a given species type. Register mutations using aIForestryPlugin.- 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
Gets a registered species type by its ID. UseISpeciesType.cast()to get the desired type.- Returns:
- The
ISpeciesTypewith 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 returnsnullif no species type was found.- Returns:
- The
ISpeciesTypewith the given ID, ornullif 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
ISpeciesTypewith 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.
-