JavaScript
minecraftのScriptAPIでUI(Form?)を作っているのですがうまくいきません。 manifest.json: { "format_version": 2, "header": { "name": "§l§6UI ADDON", "description": "test", "uuid": "439180b7-b253-47d0-b02a-5bf5cac09e58", "version": [ 1, 0, 0 ], "min_engine_version": [ 1, 21, 51 ] }, "modules": [ { "type": "script", "language": "javascript", "uuid": "0018f939-daca-469b-bbb8-7c6d47877e0c", "version": [ 1, 0, 0 ], "entry": "scripts/Main.js" } ], "dependencies": [ { "module_name": "@minecraft/server", "version": "1.8.0" }, { "module_name": "@minecraft/server-ui", "version": "1.1.0" } ] } main.js: import { world } from "@minecraft/server"; import { ActionFormData } from "@minecraft/server-ui"; world.afterEvents.itemUse.subscribe(data => { const player = data.source; const item = data.itemStack; if (item.typeId === "minecraft:diamond") { const sampleForm = new ActionFormData(); sampleForm.title("TEST UI"); sampleForm.body("test"); sampleForm.button("a"); sampleForm.button("i"); sampleForm.show(player).then(({ selection, canceled }) => { if (canceled) return; if (selection === 0) { player.sendMessage("a"); } if (selection === 1) { player.sendMessage("i"); } }) } return; })