Client UI
Add title-screen actions and describe texture-backed screens through the mc adapter client/ui package.
Some APIs may still change or behave unevenly because they do not have enough real-world use cases and test coverage yet.
Client UI
The UI package is space.nows.mc.api.client.ui. It is intentionally small: title-screen hooks, simple button/render callbacks and ScreenSpec metadata for texture-backed screens.
Title-Screen Buttons
Use TitleScreenUi.addButton for small actions on Minecraft’s title screen.
MinecraftApi.ui(context).titleScreen().addButton(screen -> {
screen.addButton(
screen.centerX(120),
screen.height() / 4 + 96,
120,
20,
"My Mod",
() -> screen.showNowsMods(context));
});
ScreenContext gives you screen size helpers, button helpers, close() and showNowsMods(context).
Keep title-screen actions lightweight. Do not replace the vanilla title screen from this hook.
Custom Title Rendering
Use TitleScreenUi.render only for small overlays.
MinecraftApi.ui(context).titleScreen().render(render -> {
// draw small diagnostic text or status using RenderContext
});
Avoid long-running work, layout-heavy rendering or anything that assumes a fixed vanilla title-screen composition.
Texture-Backed Screen Specs
ScreenSpec describes container-like screen metadata: layout id, title, background texture, width, height, inventory label position and progress bars.
ScreenSpec screen = ScreenSpec.builder(
"my_mod:machine",
McText.translatable("screen.my_mod.machine"),
"my_mod:textures/gui/machine.png")
.size(176, 166)
.inventoryLabelY(72)
.progress(ScreenProgressSpec.horizontal("heat", 80, 34, 24, 17, 0, 1))
.build();
ScreenProgressSpec.horizontal(...) uses two synced data indexes: one for value and one for max.
Use ScreenSpec for stable machine/container screens. Use native screens when you need custom widgets, animations, drag behavior or renderer-specific details.
Simple Screen Callbacks
ScreenContext.showSimpleScreen can open a simple Nows screen from another Nows screen.
screen.showSimpleScreen(
"Machine Info",
info -> info.addButton(info.centerX(80), 120, 80, 20, "Close", info::close),
render -> {
// draw simple content through RenderContext
});
This API is deliberately modest. It is useful for Nows-owned screens and diagnostics, not as a full replacement for Minecraft screens.