Files
Reeks2Missie6/scripts/triggers.ts
Bram Verhulst ba384d79d8 feat: Add cracked glass block and texture
Added the cracked glass block and its corresponding texture to the resource packs. Also made changes to the maker.ts file to include a save operation. Additionally, added a new behavior pack for the cracked glass block with specific properties. Updated the vectorUtils.ts file to include a new function for converting a Vector3 object to a command string. Finally, made changes to the triggers.ts file to register new triggers and update existing ones.
2024-07-05 14:14:17 +02:00

47 lines
1.5 KiB
TypeScript

import { Dimension, MinecraftBlockTypes, world } from "@minecraft/server";
import { CCTrigger } from "./Commandeer/Trigger/CCTrigger";
import { mindKeeper, triggerManager } from "./main";
import { vector3 } from "./Commandeer/utils/vectorUtils";
import { delay } from "./Commandeer/utils/waitUtil";
// const triggerManager = new CCTrigger.Manager(mindKeeper);
triggerManager.RegisterFunctionTrigger("test", (event) => {
world.sendMessage("Wow, this is a trigger :O");
world.sendMessage("This was caused by " + event.player.name);
});
triggerManager.RegisterFunctionTrigger("lightPath", (event) => {
lightUpPath();
});
triggerManager.RegisterFunctionTrigger("resetPath", (event) => {
resetLightPath();
});
triggerManager.RegisterFunctionTrigger("test2", (event) => {
world.sendMessage("Wow, this is another trigger :O");
});
triggerManager.RegisterFunctionTrigger("die", (event) => {
world.sendMessage("You died");
event.player.applyDamage(1000);
});
//fill 2467 9 87 2468 9 105 redstone_block
async function lightUpPath() {
let overworld: Dimension = world.getDimension("overworld");
let pos1 = vector3(2467, 9, 87);
let pos2 = vector3(2468, 9, 105);
for (let z = pos2.z; z >= pos1.z; z--) {
overworld.fillBlocks(vector3(pos1.x, pos1.y, z), vector3(pos1.x + 1, pos1.y, z), MinecraftBlockTypes.redstoneBlock);
await delay(4);
}
// let pos2 = vector3(2468, 9, 105);
}
async function resetLightPath() {
world.getDimension("overworld").runCommand("/fill 2467 9 87 2468 9 105 air");
}