minuit

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

  1. Declare minuit as a required dependency: [1.1,2.0) in neoforge.mods.toml, or ">=1.1.0 <2.0.0" in fabric.mod.json.
  2. Leave minuit out of your jar. Players install it as its own mod and get its updates.
  3. Register the look your screens open with, at client init: Themes.register(Themes.defaultTheme().as("mymod"));
  4. Write a panel and a screen, as below.
  5. 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.

PetScreen.java
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

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.