Skip to main content
Version: 26.1+

Widgets

Widgets are the elements inside a layout: text, buttons, images, item icons, the player model, and so on. Each entry in a layout's widgets list is an object with a type field and the type's own settings:

{
"type": "palladium:text",
"text": "Hello!",
"properties": {
"alignment": "center",
"y": -20
}
}

Common Properties​

Every widget accepts an optional properties object with the same set of fields:

FieldTypeRequiredFallbackDescription
alignmentAlignmentNotop_leftWhich point of the layout the widget is anchored to. See Positioning.
xIntegerNo0Horizontal offset from the anchor point. Can be negative.
yIntegerNo0Vertical offset from the anchor point. Can be negative.
widthIntegerNoper typeWidth of the widget. Most types default to 50, square types (icon, item) to 16.
heightIntegerNoper typeHeight of the widget. Most types default to 18, square types (icon, item) to 16.
actionActionNo/Action to run on click. Only used by button widgets. See Click Actions.
tooltipText ComponentNo/Tooltip shown while hovering the widget.
visibilityCondition(s)NoalwaysThe widget is only shown while the condition is true. Re-checked every tick.

Positioning​

Widgets are not laid out automatically; each one is positioned on its own. The alignment anchors the widget to one of nine points of the layout's padded area, and x/y shift it from there:

top_left top_center top_right
middle_left center middle_right
bottom_left bottom_center bottom_right

For centered alignments the widget's own size is taken into account, so "alignment": "center" with no offsets puts the widget exactly in the middle. Offsets always move the widget right (x) and down (y); use negative values for the other direction. A back button in the bottom right corner, 4 pixels off the edge, would be:

"properties": {
"alignment": "bottom_right",
"x": -4,
"y": -4,
"width": 60,
"height": 20
}

Click Actions​

The action property makes buttons do something when pressed. It uses the vanilla dialog action format, so everything vanilla supports works here: minecraft:run_command, minecraft:open_url, minecraft:suggest_command, minecraft:show_dialog, minecraft:copy_to_clipboard, and the dynamic variants.

Palladium adds three more action types:

  • palladium:open_screen opens another Palladium screen (field screen, the screen ID). This is how you link screens together into multi-page menus.
  • palladium:open_customization_screen opens the player customization screen (optional field category to jump to a category).
  • palladium:custom_event sends an event to the server. This is the way to make a button do something server-side beyond running a command; see Custom Events below.
{
"type": "palladium:button",
"text": "Choose your side",
"close_on_press": true,
"properties": {
"action": {
"type": "minecraft:run_command",
"command": "function mypack:choose_side"
}
}
}

Only the two button widgets (palladium:button and palladium:flat_button) execute actions; on all other widgets the action property is ignored. Commands run through actions are executed by the player, with their permission level, exactly like the vanilla dialog system.

Custom Events​

The palladium:custom_event action sends an event with a freely chosen ID and optional NBT data to the server:

FieldTypeRequiredDescription
idIDYesThe event ID. Use your own namespace.
dataObjectNoArbitrary NBT data sent along with the event.

On the server, the event fires the palladium:custom_event advancement criterion trigger, so anything that listens to criterion triggers can react to it. The main consumer is the automation system, where you can match on the event ID and data and run server-side actions; inside the automation, the event ID and data are also available on the context. It also works as a regular criterion in advancements.

{
"type": "palladium:button",
"text": "Claim reward",
"properties": {
"action": {
"type": "palladium:custom_event",
"id": "mypack:claim_reward",
"data": { "tier": 2 }
}
}
}

Keep in mind that the client decides what it sends: treat an incoming event like a button press, not as trusted data, and put any real checks into the automation's condition.

Visibility​

The visibility property takes the same conditions used everywhere else in Palladium, tested against the viewing player. Since it is re-evaluated every tick while the screen is open, you can build screens that react to the player's state, for example showing a button only once a power is unlocked:

"properties": {
"visibility": {
"type": "palladium:has_power",
"power": "mypack:super_strength"
}
}

Widget Types​

Blit​

ID: palladium:blit
Renders a simple (piece of a) texture
KeyTypeDescriptionRequiredFallback
textureTexture ReferenceTexture path/dynamic texture/
uInteger / ValueU-position on the texture where to start drawing from0
vInteger / ValueV-position on the texture where to start drawing from0
texture_widthInteger / ValueTotal width of the texture file256
texture_heightInteger / ValueTotal height of the texture file256
rotationFloat / ValueRotation in degrees, applied around the center of the widget0
scaleFloat / ValueScale multiplier, applied around the center of the widget. Only affects rendering, the widget keeps its original bounds1
opacityFloat / ValueOpacity between 0 (invisible) and 1 (fully opaque)1
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Button​

ID: palladium:button
Adds a button.
KeyTypeDescriptionRequiredFallback
textText ComponentText of the button/
close_on_pressBooleanWhether or not the screen will be closed when pressing the button./
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Colored Rectangle​

ID: palladium:colored_rectangle
Renders a colored rectangle.
KeyTypeDescriptionRequiredFallback
colorColorThe color for the rectangle./
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Custom Button​

ID: palladium:custom_button
Adds a button with a custom texture.
KeyTypeDescriptionRequiredFallback
textText ComponentText of the button/
backgroundButton Background (enabled*, disabled, highlighted)The background that is drawn for the button. Can specify separate textures for normal, disabled and highlighted states./
close_on_pressBooleanWhether or not the screen will be closed when pressing the button./
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Flat Button​

ID: palladium:flat_button
Adds a flat button.
KeyTypeDescriptionRequiredFallback
textText ComponentText of the button/
close_on_pressBooleanWhether or not the screen will be closed when pressing the button./
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Gradient Rectangle​

ID: palladium:gradient_rectangle
Renders a gradient rectangle.
KeyTypeDescriptionRequiredFallback
color_fromColorThe color for the start of the gradient./
color_toColorThe color for the end of the gradient./
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Icon​

ID: palladium:icon
Renders an icon
KeyTypeDescriptionRequiredFallback
iconIcon definitionThe icon to be rendered/
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Icon Button​

ID: palladium:icon_button
Adds a button that renders an icon instead of text.
KeyTypeDescriptionRequiredFallback
iconIcon definitionIcon that is rendered on the button/
backgroundButton Background (enabled*, disabled, highlighted)The background that is drawn for the button. If not specified, the default vanilla button texture is used./
close_on_pressBooleanWhether or not the screen will be closed when pressing the button./
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Item​

ID: palladium:item
Renders an item
KeyTypeDescriptionRequiredFallback
itemItem / ItemStackThe item stack to be rendered/
decorationsBooleanWhether or not item stack "decorations" should be drawn (count, damage, etc.).true
tooltipBooleanWhether or not the default tooltip for the item information should be rendered. If enabled, this will override the tooltip of the properties.true
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Player Display​

ID: palladium:player_display
Renders your player on the screen
KeyTypeDescriptionRequiredFallback
scaleFloat (>= 0.0)Scale of the player.30
follow_mouseBooleanWhen enabled the player will follow the mouse cursor.false
mimic_playerBooleanWhen enabled the player will copy all of the actual player's properties. Equipment, animation, render layers, etc.true
rotationVector 3DThe rotation that is applied to the player. If 'follow_mouse' is active, the rotation will be ignored./
render_layersIdentifier,
Identifier[]
List of/single render layer ID that will be attached to the rendered player./
apply_customization_category_previewCustomization Category ID(s)ID(s) of customization category that should be previewed/
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Power List​

ID: palladium:power_list
Renders a scrollable list of all abilities of a power
KeyTypeDescriptionRequiredFallback
powerPower IDThe power that will be displayed. If none is specified, it will use the from the current power screen (if this widget is used in one)./
backgroundUI BackgroundThe background that is drawn behind the list."minecraft:textures/block/red_wool.png"
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Power Name​

ID: palladium:power_name
Renders the name of a power.
KeyTypeDescriptionRequiredFallback
powerPower IDThe power that will be displayed. If none is specified, it will use the from the current power screen (if this widget is used in one)./
colorColorColor of this text"#404040"
shadowBooleanWhether or not this text has a shadowfalse
alignmentleft
center
right
Alignment of this textleft
overflowclamped
scrolling
How to behave if the text is longer than the widget widthclamped
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Power Tree​

ID: palladium:power_tree
Renders an interactable tree for a power of a power
KeyTypeDescriptionRequiredFallback
powerPower IDThe power that will be displayed. If none is specified, it will use the from the current power screen (if this widget is used in one)./
treeIdentifierThe power tree file that defines the layout, from 'assets//palladium/power_trees/'. If none is specified, the tree with the same ID as the power is used. Without any tree file, the layout is generated automatically./
backgroundUI BackgroundThe background that is drawn for the power tree."minecraft:textures/block/red_wool.png"
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Progress Bar​

ID: palladium:progress_bar
Renders a progress bar, where the filled texture is cut off according to the current value.
KeyTypeDescriptionRequiredFallback
valueInteger / ValueThe current value of the bar./
max_valueInteger / ValueThe value at which the bar is full. Values of 0 or less leave the bar empty./
background_textureTexture ReferenceTexture path/dynamic texture drawn behind the filled part. If not set, only the filled part is drawn./
uInteger / ValueU-position on the textures where to start drawing from0
vInteger / ValueV-position on the textures where to start drawing from0
texture_widthInteger / ValueTotal width of the texture files256
texture_heightInteger / ValueTotal height of the texture files256
opacityFloat / ValueOpacity between 0 (invisible) and 1 (fully opaque)1
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Text​

ID: palladium:text
Renders a text component
KeyTypeDescriptionRequiredFallback
textText Component / ValueThe text to be drawn/
colorColorColor of this text"#404040"
shadowBooleanWhether or not this text has a shadowfalse
alignmentleft
center
right
Alignment of this textleft
overflowclamped
scrolling
How to behave if the text is longer than the widget widthclamped
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}

Text Box​

ID: palladium:text_box
Renders a scrollable text box
KeyTypeDescriptionRequiredFallback
textText ComponentThe text to be drawn/
propertiesUI PropertiesProperties of this widget{"width":50,"height":18}