跳转至

Genetics

文档版本:1.21.0.24

Defines the way a mob's genes and alleles are passed on to it's offspring, and how those traits manifest in the child. Compatible parent genes are crossed together, the alleles are handed down from the parents to the child, and any matching genetic variants fire off JSON events to modify the child and express the traits.

架构

genetics:
{
  number "mutation_rate" : opt
  array "genes" : opt
  {
    object "<any array element>" : opt
    {
      integer "allele_range" : opt
      object "allele_range" : opt
      {
        integer "range_min" : opt
        integer "range_max" : opt
      }
      array "genetic_variants" : opt
      {
        object "<any array element>" : opt
        {
          event_object "birth_event"
           "both_allele" : opt
          integer "either_allele" : opt
          integer "hidden_allele" : opt
           "main_allele" : opt
          number "mutation_rate" : opt
        }
      }
      string "name" : opt
    }
  }
}
mutation_ratenumber
Chance that an allele will be replaced with a random one instead of the parent's allele during birth.
genesarray
The list of genes that this entity has and will cross with a partner during breeding.
genes
<any array element>object
The list of genes that this entity has and will cross with a partner during breeding.
<any array element>
allele_rangeinteger
The range of positive integer allele values for this gene. Spawned mobs will have a random number in this range assigned to them.
allele_rangeobject
The range of positive integer allele values for this gene. Spawned mobs will have a random number in this range assigned to them.
allele_range
range_mininteger
Lower bound of the vaues.
range_maxinteger
Upper bound of the vaues.
genetic_variantsarray
The list of genetic variants for this gene. These check for particular allele combinations and fire events when all of them are satisfied.
genetic_variants
<any array element>object
The genetic variant for this gene. These check for particular allele combinations and fire events when all of them are satisfied.
<any array element>
birth_eventevent_object
Event to run when this mob is created and matches the above allele conditions.
event_object:
{
  filters "filters"
  string "event" : opt
  string "target" : opt
}
filtersfilters
一个过滤器组
eventstring
The event to fire.
targetstring
The target of the event.
both_allele
If this value is non-negative, compare both the mob's main and hidden alleles with this value for a match with both. Can also be a range of integers.
either_alleleinteger
If this value is non-negative, compare both the mob's main and hidden alleles with this value for a match with either. Can also be a range of integers.
hidden_alleleinteger
If this value is non-negative, compare the mob's hidden allele with this value for a match. Can also be a range of integers.
main_allele
If this value is non-negative, compare the mob's main allele with this value for a match. Can also be a range of integers.
mutation_ratenumber
If this value is non-negative, overrides the chance for this gene that an allele will be replaced with a random one instead of the parent's allele during birth. Non-negative values greater than 1 will be the same as the value 1.
namestring
The name of the gene.