init
This commit is contained in:
24
scripts/Commandeer/utils/levelUtils.ts
Normal file
24
scripts/Commandeer/utils/levelUtils.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { BlockType, BlockTypes, BlockVolume, Vector3, world } from "@minecraft/server";
|
||||
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
|
||||
|
||||
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);
|
||||
}
|
||||
BlockTypes;
|
||||
export { Wall, clearWall, fillWall, startLevel };
|
||||
Reference in New Issue
Block a user