const weapons = Ingredient.of(/minecraft:(wooden|stone|iron|golden|diamond|netherite)_(sword|shovel|(pick)?axe|hoe)/);
// const armorsRegex = Ingredient.of(/(ceramics|minecraft):(clay|leather|chainmail|iron|golden|diamond|netherite)_(helmet|chestplate|leggings|boots)/)
const armors = [
    "minecraft:leather",
    "minecraft:chainmail",
    "minecraft:iron",
    "minecraft:golden",
    "minecraft:diamond",
    "minecraft:netherite",
]
const armorPieces = ["helmet", "chestplate", "leggings", "boots"]

onEvent("item.modification", (event) => {
    event.modify(weapons, (weapon) => {
        weapon.setMaxDamage(1);

        weapon.setTier((tier) => {
            tier.uses = 1;
            tier.speed = 0;
            tier.attackDamageBonus = 0;
            tier.level = 0;
            tier.enchantmentValue = 0;
        });
    });

    armors.forEach(armor => {
        armorPieces.forEach(piece => {
            event.modify(`${armor}_${piece}`, (full) => {
                full.setMaxDamage(1);
            });
        })
    })

    event.modify(`minecraft:bow`, (item) => {
        item.setMaxDamage(1);
    });

    event.modify(`minecraft:crossbow`, (item) => {
        item.setMaxDamage(1);
    });
});
