Redo managing structure how-to page and rename ./menu to ./structool

This commit is contained in:
ForestOfLight
2025-04-14 23:27:05 -07:00
Unverified
parent 0c361a2523
commit 8a380dc173
8 changed files with 46 additions and 30 deletions
+20
View File
@@ -0,0 +1,20 @@
import { Command } from '../lib/canopy/CanopyExtension';
import { extension } from '../config';
import { world, system } from '@minecraft/server';
import { MenuForm } from '../classes/MenuForm';
const ACTION_ITEM = 'minecraft:paper';
const structoolCmd = new Command({
name: 'structool',
description: { text: 'Opens the StrucTool Menu. Using a paper will also open the menu.' },
usage: 'structool',
callback: (sender) => new MenuForm(sender)
});
extension.addCommand(structoolCmd);
world.beforeEvents.itemUse.subscribe((event) => {
if (!event.source || event.itemStack?.typeId !== ACTION_ITEM) return;
event.cancel = true;
system.run(() => structoolCmd.getCallback()(event.source));
});