Interface IChromosome<V>
- Type Parameters:
V- The value type stored inline in the genome for this chromosome.
- All Known Implementing Classes:
Chromosome
public interface IChromosome<V>
A chromosome is a typed key in a genome that maps to an
AllelePair of inline values.
The five former subtypes (boolean/float/integer/value/registry) are collapsed into this single generic type.
- Data chromosomes hold a literal value type (
Float,Integer,Boolean, an enum,Vec3i, ...).resolver()isnull. - Reference chromosomes (species, flower type, bee effect, activity, fruit, tree effect, cocoon,
butterfly effect) have
V = ResourceLocation: the genome stores the id, andresolver()resolves the id to the behavior object on demand.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceResolves a reference chromosome's storedResourceLocationto its behavior object and back. -
Method Summary
-
Method Details
-
id
net.minecraft.resources.ResourceLocation id()- Returns:
- Unique ID for this chromosome.
-
valueCodec
com.mojang.serialization.Codec<V> valueCodec()- Returns:
- Codec for the value stored inline in the genome. Reference chromosomes encode a
ResourceLocation.
-
valueStreamCodec
net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,V> valueStreamCodec()- Returns:
- Stream codec for the value, used to sync genomes over the network.
-
chromosomeTranslationKey
String chromosomeTranslationKey()- Returns:
- The translation key for the name of this chromosome (e.g. "chromosome.forestry.speed").
-
translationKey
The naming rule for values of this chromosome. Returns a translation key only; never aComponent. Consumers build components at the UI edge, falling back to the raw value when the key has no translation.- Returns:
- A translation key naming the given value.
-
resolver
- Returns:
- The id-to-object resolver for reference chromosomes, or
nullfor data chromosomes.
-