Skip to content

Migrating from 1.21 to 26.1.x

Since mc26.1

This page summarizes the user-facing UI API changes when moving LDLib2 UI code from the 1.21 line to the 26.1.x line.

Debug Panel

The old UI debug mode has been replaced by a Debug Panel, similar to Chrome's debug tools.

1.21 26.1.x
Press F3 to enable UI debug mode. Press F12 to open or close the Debug Panel.
Debug information is shown directly on the screen. The panel lets you inspect the live UI hierarchy, computed style, layout, and selected element state.

After opening the Debug Panel, press F1 to toggle Look Up mode. In Look Up mode, hover an element in the target UI and click it to jump to that UIElement in the Debug Panel's hierarchy and inspector.

See Debug your UI for the main usage notes.

Clipping and Masks

The old overflow and overflow-clip API is deprecated and should only be used for 1.21 compatibility. In 26.1.x, use clip and mask instead.

1.21 API 26.1.x API
overflow: visible clip: none / Clip.NONE
overflow: hidden clip: scissor / Clip.SCISSOR
setOverflowVisible(false) Still available as a helper; maps to Clip.SCISSOR.
overflow-clip: ... clip: mask or clip: dynamic-mask plus mask: ...

Clip Modes

Mode Use
NONE No clipping.
SCISSOR Clip rendering to the element's content bounds.
MASK Clip rendering with the texture provided by mask. Use this for static masks.
DYNAMIC_MASK Same as MASK, but refreshes the mask every frame. Use this for animated or changing masks.

Examples

style.clip(Clip.SCISSOR);

style.clip(Clip.MASK);
style.mask(MCSprites.BORDER);

style.clip(Clip.DYNAMIC_MASK);
style.mask(animatedMask);
style = {
    clip(Clip.SCISSOR)
}

style = {
    clip(Clip.MASK)
    mask(MCSprites.BORDER)
}
element {
    clip: scissor;
}

element.masked {
    clip: mask;
    mask: sprite(ldlib2:textures/gui/icon.png);
}

element.animated-mask {
    clip: dynamic-mask;
    mask: sprite(ldlib2:textures/gui/icon.png);
}

See UIElement: clip, UIElement: mask, and UIElement: overflow-clip for the full property reference.