Skip to content

Genetics API and Pedigree

Rifa edited this page Aug 9, 2026 · 1 revision

Genetics API & Pedigree System

Facade Class net.dasik.social.api.genetics.DasikAnimalGeneticsAPI
Supported Attributes scale, max_health, movement_speed, attack_damage
Kinship Check Depth Up to 3 generations (Parents, Grandparents)
Inbreeding Risk Range 0% (Unrelated) to 100% (Full Siblings / Self)

๐Ÿ› ๏ธ DasikAnimalGeneticsAPI Facade

DasikAnimalGeneticsAPI provides high-level static methods for consumer mods to query, update, reset, and evaluate entity genetics without directly manipulating NBT tags or raw attachment codecs.

API Method Summary

public final class DasikAnimalGeneticsAPI {
    // Size & Scale
    public static float getScale(LivingEntity entity);
    public static void setScale(LivingEntity entity, float scale);
    public static boolean isRunt(LivingEntity entity);
    public static boolean isGiant(LivingEntity entity);

    // Kinship & Pedigree
    public static boolean isRelated(LivingEntity entity1, LivingEntity entity2);
    public static int predictInbreedingRiskPercent(LivingEntity parent1, LivingEntity parent2);

    // Trait Modifiers
    public static void setTrait(LivingEntity entity, String traitKey, float value);
    public static void modifyTrait(LivingEntity entity, String traitKey, float delta);
    public static void resetGenetics(LivingEntity entity);
}

๐ŸŒณ Pedigree & Inbreeding Risk Prediction

The pedigree analyzer recursively checks parent UUID matches across ancestors:

$$\text{Inbreeding Risk (%)} = \begin{cases} 100%, & \text{if Parent1 UUID} = \text{Parent2 UUID} \\ 50%, & \text{if Full Siblings (same Parent1 AND Parent2)} \\ 25%, & \text{if Half Siblings (sharing 1 Parent)} \\ 12.5%, & \text{if Cousin overlap (sharing Grandparents)} \\ 0%, & \text{if No pedigree overlap detected} \end{cases}$$

[ Parent 1 ]             [ Parent 2 ]
     โ”‚                        โ”‚
     โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
     โ–ผ           โ–ผ            โ–ผ
[ Offspring1 ] [ Offspring2 ] 
     โ”‚               โ”‚
     โ””โ”€โ”€โ”€ BREEDING โ”€โ”€โ”˜
            โ”‚
            โ–ผ
    Inbreeding Risk = 50% (Full Siblings)

๐Ÿ’ป Developer Code Example

// Check inbreeding risk before allowing breeding
int risk = DasikAnimalGeneticsAPI.predictInbreedingRiskPercent(dog1, dog2);
if (risk > 25) {
    // Trigger inbreeding warning particles or prevent breeding
}

๐Ÿ”— Related Pages

Clone this wiki locally