24 lines
841 B
TypeScript
24 lines
841 B
TypeScript
import { BlockVolume, Vector3, world } from "@minecraft/server";
|
|
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
|
|
|
|
type Wall = {
|
|
startPos: Vector3;
|
|
endPos: Vector3;
|
|
};
|
|
|
|
function clearWall(wall: Wall) {
|
|
const volume: BlockVolume = new BlockVolume(wall.startPos, wall.endPos);
|
|
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.Air);
|
|
}
|
|
|
|
function fillWall(wall: Wall, block: string) {
|
|
const volume: BlockVolume = new BlockVolume(wall.startPos, wall.endPos);
|
|
world.getDimension("overworld").fillBlocks(volume, block);
|
|
}
|
|
|
|
function startLevel(commandBlockPos: Vector3) {
|
|
const volume: BlockVolume = new BlockVolume(commandBlockPos, commandBlockPos);
|
|
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock);
|
|
}
|
|
export { Wall, clearWall, fillWall, startLevel };
|