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() is null.
  • Reference chromosomes (species, flower type, bee effect, activity, fruit, tree effect, cocoon, butterfly effect) have V = ResourceLocation: the genome stores the id, and resolver() resolves the id to the behavior object on demand.
  • 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

      String translationKey(V value)
      The naming rule for values of this chromosome. Returns a translation key only; never a Component. 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

      @Nullable IChromosome.IReferenceResolver<?> resolver()
      Returns:
      The id-to-object resolver for reference chromosomes, or null for data chromosomes.