Class RegistryRelations

java.lang.Object
com.hexagram2021.chromosomelib.registry.RegistryRelations

public final class RegistryRelations extends Object
This class is used to register relations between registries. Please ONLY call these APIs in main thread to avoid ConcurrentModificationException!
  • Method Details

    • registerEntityType2Chromosome

      public static void registerEntityType2Chromosome(net.minecraft.world.entity.EntityType<?> entityType, net.minecraft.core.Holder<Chromosome> chromosome)
      Register the chromosome of an entity type.
      Parameters:
      entityType - the entity type
      chromosome - the chromosome
    • registerEntityType2Chromosome

      public static void registerEntityType2Chromosome(net.minecraft.world.entity.EntityType<?> entityType, net.minecraft.core.Holder<Chromosome> chromosome, int remappedIndex)
      Register the chromosome of an entity type and remap the index of chromosome.
      Parameters:
      entityType - the entity type
      chromosome - the chromosome
      remappedIndex - the remapped index of the chromosome
    • registerChromosome2GeneLocus

      public static void registerChromosome2GeneLocus(net.minecraft.core.Holder<Chromosome> chromosome, net.minecraft.core.Holder<GeneLocus> geneLocus)
      Register the chromosome of an entity type.
      Parameters:
      chromosome - the chromosome
      geneLocus - the gene locus
    • registerGeneLocus2Gene

      public static void registerGeneLocus2Gene(net.minecraft.core.Holder<GeneLocus> geneLocus, net.minecraft.core.Holder<Gene> gene)
      Register the gene locus of a chromosome.
      Parameters:
      geneLocus - the gene locus
      gene - the gene
    • registerEntityType2TraitType

      public static void registerEntityType2TraitType(net.minecraft.world.entity.EntityType<?> entityType, net.minecraft.core.Holder<TraitType> traitType)
      Register the trait of an entity type.
      Parameters:
      entityType - the entity type
      traitType - the trait type
    • registerEntityTypeTag2Chromosome

      public static void registerEntityTypeTag2Chromosome(net.minecraft.tags.TagKey<net.minecraft.world.entity.EntityType<?>> entityTypeTag, net.minecraft.core.Holder<Chromosome> chromosome)
      Sometimes some different mobs are the same species (e.g. Villager, Wandering Trader, Pillager, etc.), so they share same chromosomes.
      Parameters:
      entityTypeTag - the tag of entity types
      chromosome - the chromosome
    • registerEntityTypeTag2Chromosome

      public static void registerEntityTypeTag2Chromosome(net.minecraft.tags.TagKey<net.minecraft.world.entity.EntityType<?>> entityTypeTag, net.minecraft.core.Holder<Chromosome> chromosome, int remappedIndex)
      Sometimes some different mobs are the same species (e.g. Villager, Wandering Trader, Pillager, etc.), so they share same chromosomes.

      The index of chromosome is also remapped.

      Parameters:
      entityTypeTag - the tag of entity types
      chromosome - the chromosome
      remappedIndex - the remapped index of the chromosome
    • registerEntityTypeTag2TraitType

      public static void registerEntityTypeTag2TraitType(net.minecraft.tags.TagKey<net.minecraft.world.entity.EntityType<?>> entityTypeTag, net.minecraft.core.Holder<TraitType> traitType)
      Sometimes some different mobs are the same species (e.g. Villager, Wandering Trader, Pillager, etc.), so they may share same traits.
      Parameters:
      entityTypeTag - the tag of entity types
      traitType - the trait type
    • registerDisableRelation

      public static void registerDisableRelation(net.minecraft.core.Holder<Gene> dominant, net.minecraft.core.Holder<Gene> recessive)
      Dominant genes can render recessive genes ineffective, while many genes in reality are not binary. Please use this function to register all relative explicit implicit relationships. For genes of incomplete dominance, co dominance, and mosaic dominance types, please specify rules in TraitHandler.HANDLERS instead of this method. Two genes should be (multiple) geneLocusInstances of the same gene locus.
      Parameters:
      dominant - the dominant gene
      recessive - the recessive gene
    • registerGeneFrequency

      public static void registerGeneFrequency(net.minecraft.core.Holder<GeneLocus> geneLocus, IWeightedGeneList.Builder entries)
      Register the gene frequency of a gene locus.

      Notice that holders are NOT typed Holder.Direct. Either AbstractRegisterEntry or Holder.Reference is acceptable.

      Parameters:
      geneLocus - the gene locus
      entries - genes and their weights
    • registerNecessaryChromosomeTypes

      public static void registerNecessaryChromosomeTypes(net.minecraft.core.Holder<Chromosome> chromosome, ChromosomeType chromosomeType)
      Register a necessary chromosome type of chromosome of a diploid.

      For example, X is necessary in XX/XY system, while Z is necessary in ZZ/ZW system.

    • freezeAndBuild

      @Internal public static void freezeAndBuild()