LootJS.modifiers((event) => {

    event
        .addEntityLootModifier('realmrpg_demons:chort')
        .removeLoot(Ingredient.all)
        .addLoot(LootEntry.of('create_dd:coal_piece').when((c) => c.randomChance(0.75)))
        .addLoot(LootEntry.of('miners_delight:bat_rolls').when((c) => c.randomChance(0.5)))
        .addLoot(LootEntry.of('pots_and_mimics:treasure_pot').when((c) => c.randomChance(0.05)));
    event
        .addEntityLootModifier('realmrpg_demons:imp')
        .removeLoot(Ingredient.all)
        .addLoot(LootEntry.of('create_dd:blaze_gold').when((c) => c.randomChance(0.70)))
        .addLoot(LootEntry.of('create:blaze_cake').when((c) => c.randomChance(0.5)))
        .addLoot(LootEntry.of('create_dd:blaze_gold_casing').limitCount([2,4]));
    event
        .addEntityLootModifier('realmrpg_demons:imp_guard')
        .removeLoot(Ingredient.all)
        .addLoot(LootEntry.of('create_dd:overcharge_alloy').when((c) => c.randomChance(0.65)))
        .addLoot(LootEntry.of('create:experience_nugget').limitCount([2,4]).when((c) => c.randomChance(0.5)))
        .addLoot(LootEntry.of('minecraft:book').enchantRandomly().when((c) => c.randomChance(0.5)))
        .addLoot(LootEntry.of('create_dd:overcharged_casing').limitCount([2,4]));
    event
        .addEntityLootModifier('realmrpg_demons:demon')
        .removeLoot(Ingredient.all)
        .addLoot(LootEntry.of('create_dd:refined_radiance').when((c) => c.randomChance(0.60)))
        .addLoot(LootEntry.of('create_sa:heap_of_experience').limitCount([1,2]).when((c) => c.randomChance(0.5)))
        .addLoot(LootEntry.of('create_dd:refined_radiance_casing').limitCount([2,4]));   
    event
        .addEntityLootModifier('realmrpg_demons:demon')
        .randomChance(.99)
        .addWeightedLoot([
            LootEntry.of('#minecards:smeltable_cards').addNBT({Foil:1,Quality:1}).withChance(20),
            LootEntry.of('#minecards:smeltable_cards').addNBT({Foil:1,Quality:2}).withChance(20),
            LootEntry.of('#minecards:smeltable_cards').addNBT({Foil:1,Quality:3}).withChance(10),
            LootEntry.of('#moa_decor_toys:plushies').withChance(50)
        ]);
    event
        .addEntityLootModifier('realmrpg_demons:demon_lord')
        .removeLoot(Ingredient.all)
        .addLoot(LootEntry.of('create_dd:shadow_steel').when((c) => c.randomChance(0.50)))
        .addLoot(LootEntry.of('create_dd:experience_ingot').limitCount([1, 2]).when((c) => c.randomChance(0.5)))
        .addLoot(LootEntry.of('minecraft:nether_star').when((c) => c.randomChance(0.50)))
        .addLoot(LootEntry.of('create_dd:stargaze_singularity_casing').limitCount([2, 4]))
        .addLoot(LootEntry.of('create_dd:shadow_steel_casing').limitCount([2, 4]));
    event
        .addEntityLootModifier('realmrpg_demons:ancient_demon_lord')
        .removeLoot(Ingredient.all)
        .addLoot(LootEntry.of('minecraft:netherite_ingot'))
        .addLoot(LootEntry.of('create_dd:experience_mass').limitCount([1, 2]))
        .addLoot(LootEntry.of('create_dd:netherite_casing').limitCount([2, 4]));

    // =========================================
    // Realm RPG Treasure Pots
    // ========================================= 
    event
        .addBlockLootModifier('pots_and_mimics:treasure_pot')
        .matchMainHand(ItemFilter.custom(item => item.hasTag("minecraft:tools")).and(ItemFilter.hasEnchantment("minecraft:silk_touch").negate()))
            .removeLoot(Ingredient.all)
            .addAlternativesLoot(
                LootEntry.of('betterarcheology:artifact_shards').when((c) => c.randomChance(0.5)),
                LootEntry.of('copperative:patina').limitCount([2, 8])
            );

    // =========================================
    // Realm RPG Skeletons
    // =========================================     
    event
        .addBlockLootModifier(/^realmrpg_skeletons:.*skeleton$/)
        .matchMainHand(ItemFilter.custom(item => item.hasTag("minecraft:tools")).and(ItemFilter.hasEnchantment("minecraft:silk_touch").negate()))
        .randomChance(.50)
        .addWeightedLoot([
            LootEntry.of('create:experience_nugget').limitCount([4,8]).withChance(50),
            LootEntry.of('moa_decor_toys:esqueleto').withChance(5),
            LootEntry.of('moa_decor_toys:aranayesqueleto').withChance(5),
            LootEntry.of('moa_decor_toys:caballoesqueletoyesqueleto').withChance(5),
            LootEntry.of('skinnedlanterns:skeleton_lantern_block').withChance(10),
            LootEntry.of('skinnedlanterns:skeleton_soul_lantern_block').withChance(10),
            LootEntry.of('minecraft:skull_pottery_sherd').withChance(20),
            LootEntry.of('miners_delight:bone_broth_cup').limitCount([4,8]).withChance(20) 
        ]);
    event
        .addBlockLootModifier(/^realmrpg_skeletons:.*skeleton$/).randomChance(.10).apply(ctx => {
            Utils.rollChestLoot('wares:chests/skeleton_sealed_agreements').forEach(item => {
            ctx.addLoot(item);
            });
        });
});