#script forms dont show panel
1 messages · Page 1 of 1 (latest)
/********************************************************
+* (c) Mojang. All rights reserved *
+* (c) Microsoft. All rights reserved. *
+*********************************************************/
{
"namespace": "server_form",
"$schema": "https://kalmemarq.github.io/Bugrock-JSON-UI-Schemas/ui.schema.json",
"long_form@common_dialogs.main_panel_no_buttons": {
"$title_panel": "common_dialogs.standard_title_label",
"$title_size": [
"100% - 14px",
10
],
"size": [
225,
200
],
"$text_name": "#title_text",
"$title_text_binding_type": "none",
"$child_control": "server_form.long_form_panel",
"layer": 2,
"bindings": [
{
"binding_name": "#title_text"
},
{
"binding_type": "view",
"source_property_name": "(#title_text = 'Title Test')",
"target_property_name": "#visible"
}
]
}
}
server_forms.json ^^^^^^^^^^^^^^^^^^^^
import { system, world } from "@minecraft/server"
import { ActionFormData } from "@minecraft/server-ui"
system.run(() => {
const UI_test = new ActionFormData()
.title('Title')
.body('')
.button('A')
.button('B')
.button('C')
const UI_test2 = new ActionFormData()
.title('Title Test')
.body('')
.button('A')
.button('B')
.button('C')
world.afterEvents.itemUse.subscribe(event => {
const { itemStack, source } = event;
switch(itemStack.typeId) {
case "minecraft:clock":
UI_test.show(source as any)
break;
case "minecraft:compass":
UI_test2.show(source as any)
break;
}
})
})
test.ts^^^^^^^^^^^^^^
ts? Minecraft only supports js
rename it to a .js file and remove the ts-specific syntax such as as or compile the ts to a js file in order to use it in your addon
you can use ts.