import {world, Player} from "@minecraft/server";
import {pickaxesState,axesState,shovelsState,hoesState} from '../config.js'
import { debug, Check, getCooldownTime, clamp, healthParticle, toColor } from "../mathAndCalculations.js";

// Run cooldown when the player hits block.
world.afterEvents.entityHitBlock.subscribe((data) => {
	if (world.getDynamicProperty("addon_toggle") == false) return;
	const player = data.damagingEntity;
    const block = data.hitBlock;
	if (!(player instanceof Player)) return;
	const status = player.getStatus();
	status.shieldDelay = 0;
	status.lastAttackTime = Date.now();
	player.__leftClick = true;
});
