Skip to content
“Perrier” edited this page May 23, 2026 · 4 revisions

Modding Library

A declarative, reactive UI component library for Minecraft 1.21.4 Fabric mods, written in Java 21. Build screens by composing components instead of subclassing Screen and writing imperative init() / render() boilerplate.

import static org.triggersstudio.moddinglib.client.ui.api.Components.*;
import static org.triggersstudio.moddinglib.client.ui.styling.Styles.*;

State<Integer> counter = State.of(0);

UIScreen screen = Screen(Column(
        padding(20).backgroundColor(0xFF_1A_1A_1A).build(),

        Text(counter.map(v -> "Counter: " + v),
             fontSize(16).textColor(WHITE).build()),

        Button("+1", height(28)
                .onClick((x, y, btn) -> counter.set(counter.get() + 1))
                .build())
));

MinecraftClient.getInstance().setScreen(screen);

What's inside

  • Composition APIComponents.Row(...), Components.Column(...), vararg children or Consumer<ContainerScope> builders.
  • Reactive stateState<T> with map, combine, bindBidirectional, automatic threading hop to the render thread.
  • Rich components — Text, Button, Image, TextField, TextArea, Sliders (5 numeric types), ProgressBar, Pagination, Accordion, ComboBox, SelectList, Calendar, ColorPicker, Skeleton, Spinner, Tooltip, Toast, Charts (Line/Bar/Pie), PlayerRender.
  • Animations — Tween (time-based) and Spring (physics) interpolators, full Penner easing family, Bezier and step curves, ColorTween for ARGB. FadeIn, FadeOut, SlideIn shortcuts.
  • StylingStyle.Builder with size, padding, margin, background, border, radius, opacity, font, alignment, click handler.
  • Client↔server channel — typed plugin-messaging on top of a shared Envelope codec, with a companion moddinglib-spigot plugin that exposes a simple register(pluginId, action, handler) / send(player, ...) API to other Spigot plugins. See Networking.

Project layout

The repo is split into three Gradle modules so the Fabric mod and the Spigot server plugin can share a single source of truth for the wire format without dragging each other's runtime deps along:

Module Artifact What it ships
:common moddinglib-common Pure-Java protocol: Envelope record, VarInts codec, channel name. No MC / Fabric / Bukkit imports.
:fabric moddinglib The mod itself — every UI component, animation primitive, video player, etc. Bundles :common via Loom include.
:spigot moddinglib-spigot Server-side companion plugin exposing ModdingLibApi for downstream plugins.

Read next

  • Getting Started — install + your first screen.
  • ConceptsUIComponent, State<T>, lifecycle, focus, layout flow.
  • StylingStyle.Builder, helpers, color constants.
  • Components — index of every component, organized by family.
  • AnimationsTween, Spring, Easing, ColorTween.
  • NetworkingEnvelope protocol and the Spigot-side ModdingLibApi.
  • Devmode & Examples/demomenu subcommands and bundled example screens.

Status

  • Minecraft: 1.21.4
  • Fabric Loader: 0.17.2
  • Java: 21

For the canonical roadmap (shipped / on side branch / planned / under discussion), see FEATURES.md in the main repo.

Clone this wiki locally