Skip to content

Genetics Loot Modifiers ​

ComponentClass
Modifier Interfacenet.dasik.social.api.genetics.GeneticsLootModifier
Registry Classnet.dasik.social.api.genetics.GeneticsLootRegistry
Mixin Hook Classnet.dasik.social.mixin.LivingEntityLootMixin
Target MethodLivingEntity.dropFromLootTable

🥩 Overview & Loot Interception ​

GeneticsLootRegistry allows mods to dynamically modify mob loot drops based on entity genetics (e.g., giant animals dropping extra meat, runts dropping less loot, or mutated variants dropping special items).

ascii
[ LivingEntity.dropFromLootTable ]
                │
                ▼
 ┌─────────────────────────────┐
 │    LivingEntityLootMixin    │  ◄── @ModifyVariable Consumer Hook
 └──────────────┬──────────────┘
                │
                ▼
 ┌─────────────────────────────┐
 │    GeneticsLootRegistry     │  ◄── Lookup Modifier for EntityType
 └──────────────┬──────────────┘
                │
                ▼
 ┌─────────────────────────────┐
 │    GeneticsLootModifier     │  ◄── Scale stack count / Swap item
 └─────────────────────────────┘

💻 Developer Code Example ​

Registering a loot modifier for wolves based on physical scale:

java
GeneticsLootRegistry.register(EntityTypes.WOLF, (entity, genetics, stack, random) -> {
    float scale = DasikAnimalGeneticsAPI.getScale(entity);
    if (stack.is(Items.BONE)) {
        // Scale bone drop count proportionally to entity scale
        int newCount = Math.max(1, Math.round(stack.getCount() * scale));
        return new ItemStack(Items.BONE, newCount);
    }
    return stack;
});

Official documentation & web portal for Dasik Igaijinn mods.