Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Links
Creators
Details
Shown!
Shown! is a widget-based UI library for Minecraft, allowing simple creation of interfaces for all sorts of purposes!
Screens
Just like Minecraft, you need to start with a Screen. The Screen is where your entire interface is created, and handled. The most basic screen can be created as follows:
public class ExampleScreen extends ShownScreen {
public ExampleScreen() {
super();
}
@Override
protected void init() {
super.init();
}
}
When creating and adding widgets, you should make them in init(). Your call to super.init() should also always be at the bottom, as this runs the initialization for all of the added widgets, as well as updates the dimensions of each widget.
Widgets
Adding widgets is extremely simple, as well as how they function. First, we should go over how to position and scale them.
Widgets use a custom Vector class called UIVec to handle position and scale. UIVec has two values for each axis, scale and offset. Scale is the value of the axis relative to the parent widget, while offset is a constant value. An example of how this works can be shown here:

As seen above, the entire width of the panel is 100px while the height of the box is only 80px. The elements contained within the panel are as follows:
- A red box, parented to the main panel. It has a position of (0, 0, 0, 0) and a size of (0.5, 0.5, 0, 0), therefore being 50x40px large.
- A green box, parented to the main panel. It has a position of (0.5, 0.25, 0, 0) and a size of (0.25, 0.75, 0, 0), therefore being 25x60px large, while also being positioned at (50, 20)
- A blue box, parented to the red box. It also has a position of (0, 0, 0, 0) and a size of (0.5, 05, 0, 0), therefore it is 25x20px large.
Positioning and scaling widgets this way allows for exact relativity for all screen sizes, and also specific sized elements, such as a 20px tall header bar.
Using this understanding, placing a simple panel widget in the center of the screen that is half of the size in each axis can be done as follows:
@Override
protected void init() {
PanelWidget panel = new PanelWidget(
new UIVec(0.25, 0.25, 0, 0),
new UIVec(0.5, 0.5, 0, 0)
);
this.addWidget(panel);
super.init();
}



