MCUI is a lightweight, component-based UI library for Minecraft, designed to make in-game Image rendering easier
- 📦 Component-based UI system
- 🖼️ Easy element rendering via
UIRender
- ⏱️ Tick-based rendering lifecycle
- 🔌 Built-in support for spacing and layout with
ElementSpace
- 🧱 Simple integration and extensibility
- Java 21
- PaperMC 1.21.4+
- Maven
Build the project using Maven:
mvn clean install
Add MCUI to your Maven project:
<dependency>
<groupId>dev.lrxh</groupId>
<artifactId>MCUI</artifactId>
<version>{latest-version}</version>
<scope>provided</scope>
</dependency>
⚠️ Important:
- You must declare
MCUI
as a dependency in yourplugin.yml
to ensure your plugin loads after MCUI.
Example:depend: [MCUI]- Be sure to place MCUI JAR inside the
plugins/
folder. Otherwise, your plugin will not load.
public class UIComponentExample extends UIComponent {
private final Element element;
public UIComponentExample() {
// HEIGHT and ASCENT are optional spacing parameters
element = register("image_0.png", 8, 0);
// The image must be located inside MCUI/assets
load();
}
@Override
public void tick(Player player) {
UIRender.ACTION_BAR_RENDER.render(player,
ElementSpace.BACKSPACE_48.createElement(),
element,
ElementSpace.BACKSPACE_1.createElement(),
element,
ElementSpace.BACKSPACE_1.createElement(),
element
);
}
}
UIComponent uiComponent = MCUI.INSTANCE.getComponentManager().registerComponent(new UIComponentExample());
To display or remove the UI for a specific player:
// Show UI
uiComponent.addViewer(player); // or addViewer(player.getUniqueId());
// Hide UI
uiComponent.removeViewer(player); // or removeViewer(player.getUniqueId());
You can find a full working example at:
👉 https://github.com/Devlrxxh/MCUIExample
This project is licensed under the MIT License. See LICENSE for details.