import { EquipmentSlot } from '@minecraft/server';
import { diamondTierFiveByFive } from 'item/fiveByFive';
import { treeMiner } from 'item/infernium';
import { diamondTierThreeByThree, ironTierThreeByThree, stoneTierThreeByThree } from 'item/threeByThree';
import { diamondTierVeinMiner, ironTierVeinMiner, stoneTierVeinMiner } from 'item/veinMiner';
class onMineBlock {
    constructor() {
        this.onMineBlock = this.onMineBlock.bind(this);
    }
    onMineBlock(_componentData) { }
}
export class digger extends onMineBlock {
    onMineBlock(componentData) {
        const REGEX = new RegExp('endorah_mo:digger_([0-9]+)');
        let tags = componentData.itemStack.getTags();
        let player = componentData.source;
        for (let tag of tags)
            if (REGEX.exec(tag)) {
                let item = player.getComponent('equippable').getEquipment(EquipmentSlot.Mainhand);
                if (item.getComponent('minecraft:durability').damage +
                    parseInt(REGEX.exec(tag)[1]) >=
                    item.getComponent('minecraft:durability').maxDurability) {
                    player.getComponent('equippable').setEquipment(EquipmentSlot.Mainhand, undefined);
                    break;
                }
                item.getComponent('minecraft:durability').damage += parseInt(REGEX.exec(tag)[1]);
                player.getComponent('equippable').setEquipment(EquipmentSlot.Mainhand, item);
                break;
            }
    }
}
export class diamondFiveByFive extends onMineBlock {
    onMineBlock(componentData) {
        diamondTierFiveByFive(componentData);
    }
}
export class diamondThreeByThree extends onMineBlock {
    onMineBlock(componentData) {
        diamondTierThreeByThree(componentData);
    }
}
export class ironThreeByThree extends onMineBlock {
    onMineBlock(componentData) {
        ironTierThreeByThree(componentData);
    }
}
export class stoneThreeByThree extends onMineBlock {
    onMineBlock(componentData) {
        stoneTierThreeByThree(componentData);
    }
}
export class diamondVeinMiner extends onMineBlock {
    onMineBlock(componentData) {
        diamondTierVeinMiner(componentData);
    }
}
export class ironVeinMiner extends onMineBlock {
    onMineBlock(componentData) {
        ironTierVeinMiner(componentData);
    }
}
export class stoneVeinMiner extends onMineBlock {
    onMineBlock(componentData) {
        stoneTierVeinMiner(componentData);
    }
}
export class inferniumTreeMiner extends onMineBlock {
    onMineBlock(componentData) {
        treeMiner(componentData);
    }
}
