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,9 +1,9 @@
import { Vector3, world } from "@minecraft/server";
import Level from "./level";
import pupeteer from "../pupeteer";
import { teleportAgent, isAgentAt, getAgentLocation, getAgent } from "../utils/agentUtils";
import { teleportAgent, isAgentAt, getAgentLocation } from "../utils/agentUtils";
import { startLevel } from "../utils/levelUtils";
import { vector3, Vector3Add, Vector3ToCommandString } from "../utils/vectorUtils";
import { vector3, Vector3Add } from "../utils/vectorUtils";
import { mindKeeper, CURRENT_LEVEL } from "../../main";
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
@@ -37,9 +37,9 @@ class AbstractAgentTrackMission extends Level {
let isComplete = false;
let isOutOfBounds = false;
let agentPos = getAgentLocation();
let blockLava = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -7, 0)));
let blockAir = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -1, 0)));
const agentPos = getAgentLocation();
const blockLava = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -7, 0)));
const blockAir = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -1, 0)));
if (
blockLava &&

View File

@@ -1,20 +1,18 @@
import { World } from "@minecraft/server";
class Level {
levelCompleteCallback: Function;
levelCheckCallback: Function;
levelSetupCallback: Function;
levelUpdateCallback: Function;
levelResetCallback: Function;
levelCompleteCallback: VoidFunction;
levelCheckCallback: () => boolean;
levelSetupCallback: VoidFunction;
levelUpdateCallback: VoidFunction;
levelResetCallback: VoidFunction;
isCompleted: boolean = false;
isSetup: boolean = false;
constructor(
levelSetupCallback: Function,
levelUpdateCallback: Function,
levelCompleteCallback: Function,
levelCheckCallback: Function,
levelResetCallback: Function = () => {}
levelSetupCallback: VoidFunction,
levelUpdateCallback: VoidFunction,
levelCompleteCallback: VoidFunction,
levelCheckCallback: () => boolean,
levelResetCallback: VoidFunction = () => {}
) {
this.levelSetupCallback = levelSetupCallback;
this.levelCompleteCallback = levelCompleteCallback;

View File

@@ -1,4 +1,4 @@
import { BlockType, Vector3, world, World } from "@minecraft/server";
import { Vector3, world, World } from "@minecraft/server";
export type blockCondition = {
block: string;
@@ -14,7 +14,7 @@ export type blockCondition = {
* @throws Throws an error if there is no lever at the specified position.
*/
export function leverOn(world: World, position: Vector3): boolean {
let lever = world.getDimension("overworld").getBlock(position);
const lever = world.getDimension("overworld").getBlock(position);
if (!(lever?.typeId == "minecraft:lever")) {
throw new Error(`No lever at ${position}`);
}
@@ -46,7 +46,7 @@ export type LevelNoGoZone = {
export const checkBlockCondition = (condition: LevelBlockCondition): boolean => {
let isComplete: boolean = true;
condition.conditions.forEach((condition) => {
let block = world.getDimension("overworld").getBlock(condition.position);
const block = world.getDimension("overworld").getBlock(condition.position);
if (block!.typeId != condition.block) {
isComplete = false;
}