Files
WorldHandler/run/config/worldhandler/usercontent/example/example.json
Marcel Konrad 7951c13bc5 Update to 1.18
Rewrite command builders
Usercontent api v2
2021-12-02 12:45:25 +01:00

390 lines
6.4 KiB
JSON

{
"commands": {
"example1": {
"label": "textfield",
"syntax": {
"name": "example",
"children": [
{
"name": "list_button",
"type": "resource_location",
"children": [
{
"name": "page_list",
"type": "resource_location",
"children": [
{
"name": "slider",
"type": "int",
"children": [
{
"name": "player",
"type": "player",
"children": [
{
"name": "textfield",
"label": "textfield",
"type": "string"
}
]
}
]
}
]
}
]
}
]
},
"visible": {
"type": "bool",
"bool": true
}
},
"example2": {
"label": "arg1",
"syntax": {
"name": "example2",
"children": [
{
"name": "arg1",
"label": "arg1",
"type": "float"
}
]
},
"visible": {
"type": "bool",
"bool": true
}
},
"example3": {
"label": "arg1",
"syntax": {
"name": "example3",
"children": [
{
"name": "arg1",
"label": "arg1",
"type": "int"
}
]
},
"visible": {
"type": "bool",
"bool": false
}
}
},
"gui": {
"title": "Example Title",
"tab": {
"title": "Example",
"category": "main",
"category_index": 3,
"active_content": "example"
},
"widgets": [
{
"text": "Button",
"type": "button",
"layout": {
"x": 0,
"y": 0,
"width": 56,
"height": 20
},
"action": {
"type": "js",
"attributes": {
"function": "addChatMessage",
"value": "Example message"
}
},
"attributes": {
"visible": {
"type": "bool",
"bool": true
},
"enabled": {
"type": "bool",
"bool": true
}
}
},
{
"text": "Send",
"type": "button",
"layout": {
"x": 58,
"y": 0,
"width": 56,
"height": 20
},
"action": {
"type": "run",
"attributes": {
"command": "example1",
"value": "textfield"
}
},
"attributes": {
"visible": {
"type": "bool",
"bool": true
},
"enabled": {
"type": "bool",
"bool": true
}
}
},
{
"text": "Textfield",
"type": "textfield",
"action": {
"type": "js",
"attributes": {
"function": "updateText"
}
},
"layout": {
"x": 0,
"y": 48,
"width": 114,
"height": 20
},
"attributes": {
"visible": {
"type": "js",
"function": "isVisible"
},
"enabled": {
"type": "js",
"function": "isEnabled"
},
"id": "textfield_id"
}
},
{
"type": "item_button",
"action": {
"type": "run_string",
"attributes": {
"value": "/give @p minecraft:diamond_sword 1"
}
},
"layout": {
"x": 0,
"y": 24,
"width": 20,
"height": 20
},
"attributes": {
"item": "minecraft:diamond_sword"
}
},
{
"type": "icon_button",
"action": {
"type": "open",
"attributes": {
"value": "main"
}
},
"layout": {
"x": 24,
"y": 24,
"width": 20,
"height": 20
},
"attributes": {
"icon": "home"
}
},
{
"text": "ActionHelper",
"type": "button",
"action": {
"type": "js",
"attributes": {
"function": "openContent",
"value": "settings"
}
},
"layout": {
"x": 48,
"y": 24,
"width": 66,
"height": 20
},
"attributes": {
"tooltip": "Opens Settings"
}
},
{
"type": "list_button",
"action": {
"type": "set",
"attributes": {
"command": "example1",
"argument": "list_button"
}
},
"layout": {
"x": 118,
"y": 72,
"width": 114,
"height": 20
},
"attributes": {
"items": [
{
"id": "minecraft:grass",
"translation": "block.minecraft.grass"
},
{
"id": "minecraft:stone",
"translation": "block.minecraft.stone"
},
{
"id": "minecraft:dirt",
"translation": "block.minecraft.dirt"
},
{
"id": "minecraft:cobblestone",
"translation": "block.minecraft.cobblestone"
}
]
}
},
{
"text": "Slider",
"type": "slider",
"action": {
"type": "set",
"attributes": {
"command": "example1",
"argument": "slider"
}
},
"layout": {
"x": 0,
"y": 96,
"width": 114,
"height": 20
},
"attributes": {
"id": "slider_id",
"min": 0.0,
"max": 100.0,
"start": 10.0
}
},
{
"text": "Visible",
"type": "button",
"action": {
"type": "js",
"attributes": {
"function": "toggleVisibility"
}
},
"layout": {
"x": 0,
"y": 72,
"width": 56,
"height": 20
},
"attributes": {
"tooltip": "Toggle Visibility State"
}
},
{
"text": "Enabled",
"type": "button",
"action": {
"type": "js",
"attributes": {
"function": "toggleEnabled"
}
},
"layout": {
"x": 58,
"y": 72,
"width": 56,
"height": 20
},
"attributes": {
"tooltip": "Toggle Enabled State"
}
},
{
"text": "gui.worldhandler.generic.backToGame",
"type": "button",
"action": {
"type": "back_to_game"
},
"layout": {
"x": 118,
"y": 96,
"width": 114,
"height": 20
}
}
],
"menus": [
{
"type": "page_list",
"layout": {
"x": 118,
"y": 0,
"width": 114,
"height": 20
},
"action": {
"type": "set",
"attributes": {
"command": "example1",
"argument": "page_list"
}
},
"attributes": {
"id": "page_list",
"length": 2,
"items": [
{
"id": "minecraft:grass",
"translation": "block.minecraft.grass"
},
{
"id": "minecraft:stone",
"translation": "block.minecraft.stone"
},
{
"id": "minecraft:dirt",
"translation": "block.minecraft.dirt"
},
{
"id": "minecraft:cobblestone",
"translation": "block.minecraft.cobblestone"
}
]
}
}
],
"labels": [
{
"text": "Text",
"x": 0,
"y": -11,
"color": 2039583,
"visible": {
"type": "js",
"function": "isVisible"
}
}
]
}
}