Platform.setModName('kubejs', 'Expert Edition');

ItemEvents.modification(event => {
    Ingredient.custom(items => items.stackable).getItemIds().forEach(itemId => {
        event.modify(itemId, item => {
            item.maxStackSize = 64
        });
    });

    [
        'potion',
        'splash_potion',
        'lingering_potion',
        'enigmaticlegacy:thicc_scroll',
        'enigmaticlegacy:earth_heart',
        'enigmaticlegacy:twisted_heart',
        'enigmaticlegacy:recall_potion',
        'enigmaticlegacy:mending_mixture',
        'enigmaticlegacy:cosmic_heart',
        'enigmaticlegacy:twisted_potion',
        'enigmaticlegacy:common_potion',
        'enigmaticlegacy:common_potion_splash',
        'enigmaticlegacy:common_potion_lingering',
        'enigmaticlegacy:ultimate_potion',
        'enigmaticlegacy:ultimate_potion_splash',
        'enigmaticlegacy:ultimate_potion_lingering',
        'enigmaticaddons:pure_heart',
        'enigmaticaddons:common_potion',
        'enigmaticaddons:common_potion_splash',
        'enigmaticaddons:common_potion_lingering',
        'enigmaticaddons:ultimate_potion',
        'enigmaticaddons:ultimate_potion_splash',
        'enigmaticaddons:ultimate_potion_lingering'
    ].forEach(type => {
        event.modify(type, item => {
            item.maxStackSize = 64
        });
    });

    ['axe', 'hoe', 'pickaxe', 'shovel', 'sword'].forEach(type => {
        ['wooden', 'stone', 'iron', 'diamond', 'netherite'].forEach(tier => {
            event.modify(`${tier}_${type}`, item => {
                item.maxDamage = tier === 'wooden' ? 16 : tier === 'stone' ? 192 : tier === 'iron' ? 512 : tier === 'diamond' ? 2048 : 2560
            });
        });
    });
    Ingredient.of(['shears', 'trident', 'shield']).getItemIds().forEach(type => {
        event.modify(type, item => {
            item.maxDamage = 512
        });
    });
    Ingredient.of(['enigmaticlegacy:forbidden_axe', 'enigmaticaddons:disaster_sword', 'enigmaticlegacy:ender_slayer']).getItemIds().forEach(type => {
        event.modify(type, item => {
            item.maxDamage = 2560
        });
    });
    ['pickaxe', 'axe', 'shovel', 'sword', 'scythe'].forEach(type => {
        event.modify(`enigmaticlegacy:etherium_${type}`, item => {
            item.maxDamage = 5120
        });
    });
    Ingredient.of(['enigmaticlegacy:enigmatic_elytra', 'enigmaticlegacy:astral_breaker', 'enigmaticaddons:astral_spear', 'enigmaticaddons:chaos_elytra', 'enigmaticlegacy:eldritch_pan']).getItemIds().forEach(type => {
        event.modify(type, item => {
            item.maxDamage = 5120
        });
    });
    event.modify('enigmaticaddons:evil_dagger', item => {
        item.maxDamage = 1024
    });
});
