Skip to main content
Version: 26.1+

Components

Components are the elements inside a layout: text, buttons, images, item icons, the player model, and so on. Each entry in a layout's components 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 component accepts an optional properties object with the same set of fields:

FieldTypeRequiredFallbackDescription
alignmentAlignmentNotop_leftWhich point of the layout the component 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 component. Most types default to 50, square types (icon, item) to 16.
heightIntegerNoper typeHeight of the component. Most types default to 18, square types (icon, item) to 16.
actionActionNo/Action to run on click. Only used by button components. See Click Actions.
tooltipText ComponentNo/Tooltip shown while hovering the component.
visibilityCondition(s)NoalwaysThe component is only shown while the condition is true. Re-checked every tick.

Positioning

Components are not laid out automatically; each one is positioned on its own. The alignment anchors the component 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 component's own size is taken into account, so "alignment": "center" with no offsets puts the component exactly in the middle. Offsets always move the component 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 two 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).
{
"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 components (palladium:button and palladium:flat_button) execute actions; on all other components the action property is ignored. Commands run through actions are executed by the player, with their permission level, exactly like the vanilla dialog system.

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"
}
}

Component Types

Blit

ID: palladium:blit
Renders a simple (piece of a) texture
KeyTypeDescriptionRequiredFallback
textureTexture ReferenceTexture path/dynamic texture/
uInteger (>= 0)U-position on the texture where to start drawing from0
vInteger (>= 0)V-position on the texture where to start drawing from0
texture_widthInteger (>= 0)Total width of the texture file256
texture_heightInteger (>= 0)Total height of the texture file256
propertiesUI PropertiesProperties of this component{}

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 component{}

Colored Rectangle

ID: palladium:colored_rectangle
Renders a colored rectangle.
KeyTypeDescriptionRequiredFallback
colorColorThe color for the rectangle./
propertiesUI PropertiesProperties of this component{}

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 component{}

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 component{}

Icon

ID: palladium:icon
Renders an icon
KeyTypeDescriptionRequiredFallback
iconIcon definitionThe icon to be rendered/
propertiesUI PropertiesProperties of this component{}

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 component{}

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 component{}

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 component 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 component widthclamped
propertiesUI PropertiesProperties of this component{}

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 component is used in one)./
backgroundUI BackgroundThe background that is drawn for the power tree."minecraft:textures/block/red_wool.png"
propertiesUI PropertiesProperties of this component{}

Text

ID: palladium:text
Renders a text component
KeyTypeDescriptionRequiredFallback
textText ComponentThe 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 component widthclamped
propertiesUI PropertiesProperties of this component{}

Text Box

ID: palladium:text_box
Renders a scrollable text box
KeyTypeDescriptionRequiredFallback
textText ComponentThe text to be drawn/
propertiesUI PropertiesProperties of this component{}