CoolLib

CoolLib

CoolLib is a lightweight rendering and math utility for Fabric 1.21.11. It provides a simple API for 2D animations, rounded shapes, and dynamic gradients, helping developers create polished, high-quality UIs with minimal code.

by
64 Downloads
fabric
Rent Server with this Mod

About this Mod

CoolLib

CoolLib is a lightweight rendering and mathematical utility library for Minecraft Fabric (1.21.11). It is designed to bridge the gap between standard Minecraft code and high-quality user interfaces by providing a simplified API for animations, dynamic colors, and 2D matrix transformations.

The primary goal of this library is to allow developers to polish to their mods with minimal boilerplate.

Core Modules

1. CoolRenderer

Optimized for the modern 2D Matrix3x2fStack rendering system used in 1.21.2 and beyond.

  • Shapes: Draw rounded rectangles, custom 1-pixel borders, and fading borders.
  • Transformations: Native support for UI shaking, scaling from specific anchor points, and soft outer glows.
  • State Management: Built-in helpers for scissoring (clipping) and matrix stack safety.

2. CoolColor

Advanced color manipulation and accessibility tools.

  • Dynamic Gradients: Multi-step lerping (e.g., Red to Yellow to Green) for health bars and power levels.
  • Chroma: Easy-to-use rainbow/chroma cycling with adjustable speed and saturation.
  • Contrast Awareness: Logic to automatically toggle text between black and white based on background brightness.
  • Visual Effects: Methods for flickering and pulsing colors based on game state.

3. CoolMath & CoolEffect

The engine behind the motion.

  • Smooth Interpolation: Specialized lerpAngle functions that handle 360-degree wraps without "glitching" or flipping.
  • Animation Curves: Pre-built Sin, Pulse, and Bounce waves to create "living" UI elements.

Implementation Example

To create an item that bounces and smoothly rotates to face the mouse cursor:

// Inside your render method
int x = 200;
int y = 100;

// Use CoolEffect to get a time-based bounce value
float bounce = CoolEffect.getBounceValue(2.0f, 5.0f);

// Calculate the angle to the mouse
float target = (float) Math.toDegrees(Math.atan2(mouseY - y, mouseX - x));

// Smooth the rotation so it doesn't snap
currentAngle = CoolMath.lerpAngle(currentAngle, target, 0.1f);

context.getMatrices().pushMatrix();

// Apply the transformations
context.getMatrices().translate(x, y - bounce);
CoolRenderer.rotate(context, currentAngle);

// Render the item centered
context.drawItem(new ItemStack(Items.COMPASS), -8, -8);

context.getMatrices().popMatrix();

Driving Animations

If you want to create your own custom progress bars or fading effects, you can use Minecraft's MathHelper alongside CoolLib:

// Creates a value that smoothly cycles between 0.0 and 1.0
float progress = (MathHelper.sin(System.currentTimeMillis() / 1500.0f) + 1.0f) / 2.0f;

// Pass that progress into CoolLib for a dynamic health bar
int color = CoolColor.getHealthColor(progress);
CoolRenderer.drawProgressBar(context, x, y, width, height, progress, color);

License

This project is licensed under the MIT License. You are free to use, modify, and distribute this library in any mod or modpack.

Available Versions

CoolLib 1.0release
MC 1.21.11fabric
March 27, 2026

How to Install CoolLib on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.11).

3

Install Mod

Open the mod browser in the dashboard and search for "CoolLib". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabric

Minecraft Versions

1.21.11

Server-side

Unsupported

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

CoolLib server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.11). You can switch loaders with one click in the panel.

Is CoolLib compatible with fabric?

CoolLib officially supports fabric for Minecraft 1.21.11. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with CoolLib – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if CoolLib consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install CoolLib with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
MIT License
Server-side
Unsupported

Supported Versions

1.21.11