Skip to content

🧬 Animal Genetics & Inherited Chiroptera Traits ​

Trait KeyTarget AttributeModifier OperationDefault BaseMin BoundMax BoundMutation Rule
scaleminecraft:generic.scaleADD_VALUE0.0f0.75f1.30funiform(0.75f, 1.30f)
movement_speedminecraft:generic.movement_speedADD_MULTIPLIED_BASE0.0f-0.04f0.08funiform(-0.04f, 0.08f)
attack_damageminecraft:generic.attack_damageADD_VALUE0.0f1.0f4.0funiform(1.0f, 4.0f)

🧬 Genetics Registration via DasikLibrary ​

Better Bats registers custom genetic traits for EntityTypes.BAT inside BetterBatsFabric.java using EntityGeneticsRegistry.register:

java
EntityGeneticsRegistry.register(
    EntityTypes.BAT,
    new GeneticsConfig(
        Map.of(
            "scale", new TraitConfig(
                "scale", "minecraft:generic.scale", "ADD_VALUE", 0.0f, 1.0f, 0.75f, 1.30f
            ),
            "movement_speed", new TraitConfig(
                "movement_speed", "minecraft:generic.movement_speed", "ADD_MULTIPLIED_BASE", 0.0f, 1.0f, -0.04f, 0.08f
            ),
            "attack_damage", new TraitConfig(
                "attack_damage", "minecraft:generic.attack_damage", "ADD_VALUE", 0.0f, 1.0f, 1.0f, 4.0f
            )
        ),
        Map.of(
            "default", Map.of(
                "scale", new MutationRule("uniform", 0.75f, 1.30f),
                "movement_speed", new MutationRule("uniform", -0.04f, 0.08f),
                "attack_damage", new MutationRule("uniform", 1.0f, 4.0f)
            )
        )
    )
);

🦇 Trait Effects & Impact ​

  1. Scale / Wingspan (scale):
    • Directly scales the physical model rendering size and collision bounding box of the bat.
    • Range: $0.75\times$ (dwarf micro-bat) to $1.30\times$ (giant megabat / flying fox).
  2. Movement Speed (movement_speed):
    • Modifies base flight locomotion velocity by $-4%$ up to $+8%$.
  3. Attack Damage (attack_damage):
    • Multiplies predatory dive-bomb damage against Silverfish and Endermites: $$\text{Pest Damage} = 10.0 \times \text{attack_damage_trait}$$

🔄 Automatic Genetics Roll & Persistence ​

When a bat ticks for the first time without genetics (!DasikAnimalGeneticsAPI.hasGenetics(self)), BatMixin.betterbats$onCustomServerAiStep automatically rolls its genetic profile and applies attribute modifiers:

java
if (!DasikAnimalGeneticsAPI.hasGenetics(self)) {
    DasikAnimalGeneticsAPI.rollStats(self, "better-bats:bat");
    GeneticsEngine.applyGeneticsModifiers(self);
}

Genetics data is stored safely in vanilla entity NBT compound tags (EntityGenetics), ensuring total uninstallation safety without corrupting world saves.


Official documentation & web portal for Dasik Igaijinn mods.