CUSTOM BUTTONS IN JSON UI (Minecraft Bedrock Scripting API and JSON UI) | Dingsel
The Gist
Custom layout buttons matching CubeCraft server menus are created in Minecraft Bedrock using nested stack panels, collection indices, and dynamic UI variables.
Quick Overview
Custom server form buttons are successfully recreated in Minecraft Bedrock by using a combination of horizontal and vertical stack panels, collection binding names, and UI variables to control padding and sizing. The tutorial guides through replacing the default factory pattern with explicit control references and mapping collection indices to script properties. By configuring button size variables and padding offsets, the user eliminates layout overlapping and achieves an exact visual match of the CubeCraft shop menu interface.
Key Points: The creator uses nested stack panels with horizontal and vertical orientations to replicate the complex layout of the CubeCraft server menu. The default factory pattern for form buttons is removed so that individual buttons can be placed and managed manually. Collection indices mapped to script properties allow button selections to correctly return the corresponding numeric value in scripting API. UI variables prefixed with dollar signs and suffixed with pipe default are utilized to define adjustable button sizes across multiple nested layers. Padding size variables are increased by ten pixels beyond button dimensions to ensure clean spacing and eliminate layout overlaps. Separate horizontal and vertical sub-stacks are constructed to group the large reward button, the medium shop button, and the two smaller tool and skin buttons in the bottom right corner. Image size properties are fine-tuned separately from button bounds to ensure textures fill out the designated clickable areas properly.
Context: Minecraft Bedrock Edition allows developers to customize user interfaces using JSON UI and the scripting API, enabling the recreation of popular server menus seen on networks like CubeCraft.
Detailed Analysis
The tutorial demonstrates how to build a custom server form UI from scratch using Minecraft Bedrock JSON UI and scripting. Starting with an outer stack panel set to horizontal orientation, the creator manually places buttons instead of using the default factory pattern. Collection names and collection indices link each button to the scripting API so that clicking a button returns the correct index value. To solve sizing issues where only the outermost layer changed, UI variables like button size, padding size, and icon size are introduced and referenced throughout the element tree. By dividing the layout into a left side for the large reward button and a right stack containing a vertical sub-stack for the shop and a horizontal sub-stack for the ban tool and skins, the exact arrangement of the target server menu is achieved. Adjusting padding sizes relative to button dimensions removes all visual overlap, resulting in a polished and functional custom form.