Skip to content

Genetics Loot Modifiers

Rifa edited this page Aug 9, 2026 · 1 revision

Genetics Loot Modifiers

Component Class
Modifier Interface net.dasik.social.api.genetics.GeneticsLootModifier
Registry Class net.dasik.social.api.genetics.GeneticsLootRegistry
Mixin Hook Class net.dasik.social.mixin.LivingEntityLootMixin
Target Method LivingEntity.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).

[ 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:

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;
});

๐Ÿ”— Related Pages

Clone this wiki locally