Interface TraitHandler


public interface TraitHandler
  • Field Details

  • Method Details

    • registerHandler

      static void registerHandler(net.minecraft.core.Holder<TraitType> type, TraitHandler handler)
    • getHandler

      static TraitHandler getHandler(net.minecraft.core.Holder<TraitType> type)
    • handle

      @Contract(pure=true) net.minecraft.core.Holder<Trait> handle(ToIntFunction<net.minecraft.core.Holder<Gene>> activeGeneWeight)
      Parameters:
      activeGeneWeight - returns a weight of the given gene.

      For diploids, 0 is for inactive gene, 1 or 2 means the count of the given gene.

      Notice that autosomal, completely recessive genes will always return 0 or 2. For incompletely dominant genes, you can code different logics based on whether the return value is 1 or 2

      Returns:
      a trait of given trait type, determined by active genes