import range from "../../modules/arrayRange.js";
import Mathf from "../../modules/Mathf.js";
import registerSystem from "../../register/registerSystem.js";
import * as mc from "@minecraft/server";



class shoulderSurfing extends registerSystem {
    constructor() {
        super();
        this.tick(() => {
            this.getPlayers({excludeTags:["kingCrimson.timeErase"]}).filter(player => this.GlobalVar(player,"shoulder_surfing").var).forEach(player => {
                let lc = this.getLc(player)
                let rot = this.getRotation(player);
                this.runCommand(`execute as @s at @s anchored eyes run camera @s set minecraft:free ease 0.2 spring pos ^${-0.8-Mathf.clamp(lc.y,-0.8,-0.1)}^^-2 rot~~${-7+Mathf.clamp(rot.x,0,5)}`, player)
            })
        },1);
    }

}

const system = new shoulderSurfing();
