Mod

Brapi

Quick rating

Brapi

No reviews yet

A Fast UI Rendering Library for Fabric mods. Rounded rectangles, gradients, textures and SDF text.

API/Library
Mod Loaders
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Required
Server Unsupported

About

Project Details

Type
Mod
License
GNU Lesser General Public License v3.0 only
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

Modrinth ID

Resources

External Links

About

Description

Brapi

A UI rendering library for Fabric mods. Supports rounded rectangles, text, gradients, textures, and 9-slice sprites with a simple API. With future support for SVG rasterizer, shadows, more text options, toggleable immediate mode rendering and lines.

Why

Making good-looking UIs in Minecraft is harder than it should be. Vanilla's tools work fine for basic boxes, but as soon as you want smooth rounded corners, circles, or nice-looking text, you hit a wall. Normally you're stuck with two options:

  1. Bring in a heavy graphics library like Skia, which is hard to set-up for first time
  2. Write your own shaders from scratch, which means dealing with extra setup and boilerplate most modders would rather skip

Brapi gives a third option. It's a lightweight layer that sits on top of Minecraft's existing rendering system, so you get the nice visuals without the pain. Key Benefits:

  • Zero Boilerplate: No setup hassle. Just create a BRender, add your draw calls, and flush.
  • Complex Shapes Made Simple: Draw circles, outlines, and rounded rectangles (even with different corner sizes) in a single line of code.
  • Automatic Batching & Layering: Brapi figures out the right draw order on its own, so your UI looks right without you micromanaging it.

📦 Setup

Adding as dependency

Add the repository and dependency to build.gradle:

repositories {
    exclusiveContent {
        forRepository {
            maven {
                name = "Modrinth"
                url = "https://api.modrinth.com/maven"
            }
        }
        filter {
            includeGroup "maven.modrinth"
        }
    }
}
dependencies {
    modImplementation "maven.modrinth:brapi:0.25.3+${minecraft_version}+fabric" // only supported minecraft version is 1.21.11 right now
}

fabric.mod.json:

"depends": {
    "brapi": "*"
}

Using in code

Create a BRender instance, add draw calls, then call flush(graphics) to submit. Everything renders at end of frame sorted by layer.

🎨 All colors are ARGB: 0xFFFF0000 = opaque red, 0x80FF0000 = 50% transparent red.
📐 Coordinates are in GuiScale units: (100, 100) at scale 3 = (300, 300) pixels.

Filled shapes

  • bRender.rect(100, 100, 100, 100, 0xFFFF0000, layer); - red 100x100 rectangle
  • bRender.roundRect(100, 100, 100, 100, 0xFFFF0000, 10, layer); - rounded rectangle, 10px radius
  • bRender.roundRect(100, 100, 100, 100, 0xFFFF0000, 10, 5, layer); - 10px TL/BR, 5px TR/BL radius
  • bRender.roundRect(100, 100, 100, 100, 0xFFFF0000, 10, 5, 20, 30, layer); - individual corner radii
  • bRender.circle(100, 100, 50, 0xFFFF0000, layer); - circle, 50px radius

Gradients

All filled shapes support gradients via Gradient and GradientDirection:

  • bRender.roundRect(100, 100, 100, 100, gradient, GradientDirection.LEFT_RIGHT, 10, layer);

Directions: LEFT_RIGHT, TOP_BOTTOM, TOP_LEFT_BOTTOM_RIGHT, TOP_RIGHT_BOTTOM_LEFT

Strokes (outline only)

  • bRender.stroke(100, 100, 100, 100, 0xFFFF0000, 2, layer); - 2px outline rectangle
  • bRender.strokeRounded(100, 100, 100, 100, 0xFFFF0000, 10, 2, layer); - 2px rounded outline, 10px radius
  • bRender.strokeRounded(100, 100, 100, 100, 0xFFFF0000, 10, 5, 2, layer); - 10px TL/BR, 5px TR/BL
  • bRender.strokeRounded(100, 100, 100, 100, 0xFFFF0000, 10, 5, 20, 30, 2, layer); - individual radii

Filled + stroke

  • bRender.roundRectStroked(100, 100, 100, 100, 0xFF0000FF, 0xFFFF0000, 10, 2, layer); - blue fill, 2px red stroke

Text

  • bRender.drawText(font, "Hello!", 100, 100, 24, 0xFFFFFFFF, layer); - BFont text
  • bRender.drawText(font, formattedCharSequence, 100, 100, 24, 0xFFFFFFFF, layer); - formatted text with per-character colors

Textures

  • bRender.drawTexture(tex, 100, 100, 200, 150, 0xFFFFFFFF, linear, layer); - stretch to fill
  • bRender.drawTextureCropped(tex, 100, 100, 64, 64, 0, 0, 32, 32, 0xFFFFFFFF, linear, layer); - crop
  • bRender.drawTextureTiled(tex, 100, 100, 200, 200, 0xFFFFFFFF, linear, layer); - tile
  • bRender.drawTexture9Slice(slice, 100, 100, 300, 200, 0xFFFFFFFF, linear, layer); - 9-slice

🔄 Flushing

BRender r = new BRender();
r.roundRect(...);
r.flush(graphics); // submit to draw list

Screenshots

Gallery

  • Example screen with Brapi
    Example screen with Brapi Run /brapitest in game to test it
  • Example screen with Brapi 2: Textures
    Example screen with Brapi 2: Textures Textures: crop, tile, stretch, nine-slice, color tint (Note: the weird outlines around some text letters are fixed)

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

<1,000
Downloads
Last Updated
CurseForge
Modrinth
Created
Last synced
When ModDex last fetched and imported data for this project from CurseForge or Modrinth. High-traffic and active projects are checked more often.
Next pipeline sync