This commit is contained in:
2024-08-21 16:15:22 +02:00
parent cd5f473460
commit 35af9ffc97
38 changed files with 1122 additions and 1090 deletions

View File

@@ -1,10 +1,22 @@
import { Entity, Vector3, world } from "@minecraft/server";
import { Vector3ToString, vector3 } from "./vectorUtils";
import { mindKeeper } from "../../main";
function teleportAgent(position: Vector3) {
world
.getDimension("overworld")
.runCommand(`/execute as @a run tp @e[type=agent] ${position.x} ${position.y} ${position.z}`);
//Make a facing with vector3
type Facing = Vector3;
function teleportAgent(position: Vector3, facing: Vector3 = vector3(0, 0, 0)): void {
if (facing == vector3(0, 0, 0)) {
world
.getDimension("overworld")
.runCommand(`/execute as @a run tp @e[type=agent] ${position.x} ${position.y} ${position.z}`);
} else {
world
.getDimension("overworld")
.runCommand(
`/execute as @a run tp @e[type=agent] ${position.x} ${position.y} ${position.z} facing ${facing.x} ${facing.y} ${facing.z}`
);
}
}
function isAgentAt(position: Vector3): boolean {