Add Formatting (Thank God)

This commit is contained in:
2024-08-29 15:47:58 +02:00
parent 545e47a9f3
commit 1ab45204b9
35 changed files with 2331 additions and 254 deletions

View File

@@ -1,8 +1,8 @@
import { MolangVariableMap, Vector3, world } from "@minecraft/server";
import { MolangVariableMap, Vector3 } from "@minecraft/server";
import { Vector3Add, vector3 } from "./vectorUtils";
import { PARTICLES, spawnParticle } from "./particleUtils";
let arrowTemplate: Vector3[] = [
const arrowTemplate: Vector3[] = [
vector3(0, 0, 0),
vector3(1, 1, 0),
@@ -21,18 +21,16 @@ let arrowTemplate: Vector3[] = [
vector3(0, 5, 0),
];
let offset: Vector3 = vector3(0, 0, 0);
let angleOffset = 0;
let heightBobbing = 0;
let tickCounter = 0;
function rotate(pos: Vector3, angle: number) {
let x = pos.x;
let z = pos.z;
const x = pos.x;
const z = pos.z;
let newX = x * Math.cos(angle) - z * Math.sin(angle);
let newZ = x * Math.sin(angle) + z * Math.cos(angle);
const newX = x * Math.cos(angle) - z * Math.sin(angle);
const newZ = x * Math.sin(angle) + z * Math.cos(angle);
return vector3(newX, pos.y, newZ);
}
@@ -49,10 +47,9 @@ function drawArrow(offsetPos: Vector3) {
if (tickCounter % 2 == 0) {
angleOffset += 0.1;
heightBobbing += 0.3;
offset = vector3(46.5, 75, 220.5);
arrowTemplate.forEach((pos) => {
let rotatedPos = rotate(pos, angleOffset);
let finalPos = Vector3Add(offsetPos, rotatedPos);
const rotatedPos = rotate(pos, angleOffset);
const finalPos = Vector3Add(offsetPos, rotatedPos);
finalPos.y += Math.sin(heightBobbing) / 2;
spawnParticle(finalPos, PARTICLES.point, particleData);
});