// Gabriel Bosses

import "./entities/_bootstrap";
import "./fight/EntitiySpawner";
import "./fight/Portals";
import "./fight/Skybox";
import "./global_api/EntityRuntime";
import "./global_api/guidebook";

import "./bosses/BossFightMusicManager";
import "./entities/Player";

/// Soutz Bosses

import "./bosses/ares";
import "./bosses/hades";
import "./bosses/unknown";
import "./entities/Portals";

import { system, world } from "@minecraft/server";
import "./bosses/BossHealthHandler";
import "./entities/BossMinions";
import { Vector2 } from "./global_api/Math";
import "./guidebook/guidebook";
import "./items/custom_components";

/* world.afterEvents.entityHurt.subscribe(e => {
    if(e.damageSource.damagingEntity?.typeId == "minecraft:player" || e.damageSource.damagingEntity?.typeId == "minecraft:arrow") {
        for(let i = 0; i < 50; i++)
            e.hurtEntity.applyDamage(21)
    }
}) */

let ticks = 0;
let tps = 0;
let last = 0;
system.runInterval(() => {
    ticks++;
    if (Date.now() - last > 1000) {
        tps = ticks;
        ticks = 0;
        last = Date.now();
    }
    world.getAllPlayers().forEach((p) => {
        const move = new Vector2(
            p.inputInfo.getMovementVector().x,
            p.inputInfo.getMovementVector().y * -1
        ).rotate(p.getRotation().y);
        // p.onScreenDisplay.setActionBar("TPS: " + tps);
    });
}, 1);
