Package forestry.api.genetics
Interface IIndividual
- All Known Subinterfaces:
IBee,IButterfly,IIndividualLiving,ITree
public interface IIndividual
An individual belongs to a certain species and has a genome and life stage.
It can be mated with another individual to produce offspring.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocation -
Method Summary
Modifier and TypeMethodDescriptionbooleananalyze()default <I extends IIndividual>
Icast()copy()Copies this individual and all of its properties EXCEPT FOR ITS MATE.copyWithGenome(IGenome newGenome) Copies the individual and all of its properties EXCEPT FOR ITS MATE.net.minecraft.world.item.ItemStackcreateStack(ILifeStage stage) ISpecies<?>getMate()An optional getter forgetMate().ISpecies<?>ISpeciesType<?,?> getType()default booleanhasGlint()booleandefault booleanisSecret()voidsaveToStack(net.minecraft.world.item.ItemStack stack) Writes the state of this individual, including genome, to an item.void
-
Field Details
-
CAPABILITY_ID
static final net.minecraft.resources.ResourceLocation CAPABILITY_ID
-
-
Method Details
-
getGenome
IGenome getGenome()- Returns:
- The genome of this individual.
-
getType
ISpeciesType<?,?> getType()- Returns:
- The species type of this individual.
-
getSpecies
ISpecies<?> getSpecies()- Returns:
- The active species of this individual. Prefer this method over getting it from
getGenome().
-
getInactiveSpecies
ISpecies<?> getInactiveSpecies()- Returns:
- The inactive species of the individual. Prefer this method over getting it from
getGenome().
-
setMate
-
getMate
- Returns:
- The genome of this individual's mate, or
nullif this individual has no mate.
-
getMateOptional
- Returns:
- An optional containing this individual's mate genome, or empty if this individual has no mate.
-
isAnalyzed
boolean isAnalyzed()- Returns:
trueif this individual has been analyzed and a summary of its genome should be displayed in its tooltip.
-
analyze
boolean analyze()- Returns:
- Sets this species as analyzed. Details about the specimen can be viewed in its tooltip and analyzer pages.
-
createStack
-
saveToStack
void saveToStack(net.minecraft.world.item.ItemStack stack) Writes the state of this individual, including genome, to an item. -
hasGlint
default boolean hasGlint() -
isSecret
default boolean isSecret() -
copy
IIndividual copy()Copies this individual and all of its properties EXCEPT FOR ITS MATE. Override this method in subclasses to make sure all information is copied.- Returns:
- An exact copy of this individual with NO MATE and NOT ANALYZED.
-
copyWithGenome
Copies the individual and all of its properties EXCEPT FOR ITS MATE. However, the supplied newGenome is used instead of this individual's genome. Override this method in subclasses to make sure all information is copied.- Parameters:
newGenome- The genome to use for the copied individual.- Returns:
- A copy of this individual with the given genome with NO MATE and NOT ANALYZED.
- Since:
- 1.0.4
-
cast
-