

export function onUse(event) {
    const { itemStack, source } = event;

    const durability = itemStack.getComponent("minecraft:durability");
    if (durability.damage === durability.maxDurability) {
        source.runCommandAsync(`replaceitem entity @s slot.weapon.mainhand 0 air`);
    } else {
        durability.damage += 1;
        source.getComponent('equippable').setEquipment('Mainhand', itemStack);
        source.runCommandAsync(`particle lv_mo:bubbleshield_aura ~~~`)
        source.addEffect('resistance', (10 * 20), { amplifier: 3, showParticles: true });
    }
}

const bubble_shield = {
    onUse: onUse,
}
export default bubble_shield;




