import { BlockType, BlockTypes, BlockVolume, Vector3, world } from "@minecraft/server"; import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block"; import { vector3 } from "./vectorUtils"; type Wall = { startPos: Vector3; endPos: Vector3; }; function clearWall(wall: Wall) { let volume: BlockVolume = new BlockVolume(wall.startPos, wall.endPos); world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.Air); } function fillWall(wall: Wall, block: BlockType) { let volume: BlockVolume = new BlockVolume(wall.startPos, wall.endPos); world.getDimension("overworld").fillBlocks(volume, block); } function startLevel(commandBlockPos: Vector3) { let volume: BlockVolume = new BlockVolume(commandBlockPos, commandBlockPos); world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock); } function teleportAndFaceAgent(position: Vector3, facing: Vector3 = vector3(0, 0, 0)): void { 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 placeBlock(position: Vector3, blockType: MinecraftBlockTypes) { const block = world.getDimension("overworld").getBlock(position); block!.setType(blockType); } BlockTypes; export { Wall, clearWall, fillWall, startLevel, teleportAndFaceAgent, placeBlock };