Class ChromosomeFactory
java.lang.Object
forestry.api.core.genetics.alleles.ChromosomeFactory
Factory for the generic
Chromosome. Replaces the chromosome-creation methods of the old IAlleleManager.
Chromosomes are plain singletons created in the chromosome holder classes (BeeChromosomes, TreeChromosomes, ...).-
Method Summary
Modifier and TypeMethodDescriptionstatic IChromosome<Boolean> booleanChromosome(net.minecraft.resources.ResourceLocation id) static IChromosome<Float> floatChromosome(net.minecraft.resources.ResourceLocation id) static IChromosome<Integer> intChromosome(net.minecraft.resources.ResourceLocation id) static <R> IChromosome<net.minecraft.resources.ResourceLocation> referenceChromosome(net.minecraft.resources.ResourceLocation id, Function<net.minecraft.resources.ResourceLocation, R> get, Predicate<R> dominant) A reference chromosome: the genome stores aResourceLocation, resolved to a behavior object on demand.static <V> IChromosome<V> valueChromosome(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<V> valueCodec, Function<V, String> valueKeyPart) A data chromosome holding an enum, record, or other non-primitive value.
-
Method Details
-
floatChromosome
-
intChromosome
-
booleanChromosome
-
valueChromosome
public static <V> IChromosome<V> valueChromosome(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.Codec<V> valueCodec, Function<V, String> valueKeyPart) A data chromosome holding an enum, record, or other non-primitive value.- Parameters:
valueKeyPart- Maps a value to its translation-key suffix (e.g. enum name, "x_y_z" for Vec3i).
-
referenceChromosome
public static <R> IChromosome<net.minecraft.resources.ResourceLocation> referenceChromosome(net.minecraft.resources.ResourceLocation id, Function<net.minecraft.resources.ResourceLocation, R> get, Predicate<R> dominant) A reference chromosome: the genome stores aResourceLocation, resolved to a behavior object on demand. The translation key reproduces the existing scheme ("allele.<ns>.<chromosome>.<ref path>").- Parameters:
get- Resolves an id to its behavior object (lazily, after registries are populated).dominant- Reads the default dominance of a resolved value.
-