Getting started
Add minuit to your mod and open a first screen built from its parts.
Before you start
This page is for mod authors on NeoForge or Fabric. You do not need to know how minuit draws.
Set it up
- Declare
minuitas a required dependency:[1.1,2.0)inneoforge.mods.toml, or">=1.1.0 <2.0.0"infabric.mod.json. - Leave minuit out of your jar. Players install it as its own mod and get its updates.
- Register the look your screens open with, at client init:
Themes.register(Themes.defaultTheme().as("mymod")); - Write a panel and a screen, as below.
- Open it with
Minecraft.getInstance().setScreen(new PetScreen());
What you get
The panel lives in core, in plain Java, so it also runs in a bench. The MinuitScreen builds it on the game side.
public class PetPanel extends PanelComponent { // core, plain Java
public PetPanel(Theme theme, Words words, int left, int top) {
super(theme, words, left, top);
add(new ToggleComponent(at(new Box("sit", 10, 30, 180, 20)), words.get("mymod.sit"), false, on -> { }));
add(new ButtonComponent(at(new Box("ok", 10, 90, 80, 20)), words.get("gui.done"), () -> { })
.role(ButtonComponent.Role.PRIMARY));
}
@Override public int width() { return 200; }
@Override public int height() { return 120; }
@Override protected void drawBackground(Draw d, int mx, int my) {
theme.frame().panel(d, theme.palette(), left, top, width(), height());
}
}
public class PetScreen extends MinuitScreen { // game side
public PetScreen() { super("mymod.pet.title"); }
@Override protected PanelComponent build(int w, int h) {
return new PetPanel(Themes.byId("mymod"), words(), (w - 200) / 2, (h - 120) / 2);
}
}build runs again on every resize. Themes.byId("mymod") returns the look the player picked for your mod. Each Box takes a name, then x, y, width and height.
Tab, the arrows, Enter and Escape work on every panel. Any widget takes tooltip(...). Every MinuitScreen draws the theme tab; override showsThemeTab() to hide it.
Where to go next
- Each component has a page with its variants and code, starting with Button.
- Themes, Words and Container screens.
What counts as API
Public types in dev.dryaides.minuit, dev.dryaides.minuit.client, dev.dryaides.minuit.server and ClientInfo do not break within 1.x. Packages named internal and dev.dryaides.minuit.wire are not API. Types marked @Incubating may change in a minor release.