A broad, general-purpose shared library for AttackStudio's Fabric mods. Provides JSON config, GUI rendering, easing, particles, a tick scheduler, inventory helpers, sound utilities, text helpers, keybinding registration, toasts, and a unified /studiolib command registry — so none of that boilerplate ever gets written twice.
For players: Just drop the JAR in your mods folder alongside any mod that requires it. AStudioLib has no visible effect on its own.
Static JSON config utility backed by Gson. Handles file location, pretty-printing, and error handling.
LibConfig.write("mymod", new MyConfigData());
MyConfigData data = LibConfig.read("mymod", MyConfigData.class); // null if missingConfig files are written to .minecraft/config/<modId>.json.
Frame-rate-independent easing functions. All inputs are clamped to [0, 1].
| Method | Description |
|---|---|
easeOut(t) |
Cubic ease-out — fast start, slow finish |
easeOutBack(t) |
Ease-out with a slight overshoot |
easeInOut(t) |
Symmetric cubic ease-in-out |
sinePulse(t) |
Sine arc — peaks at t=0.5. Good for pop/bounce effects |
easeOutBounce(t) |
Arrives at destination with a physical bounce |
lerp(a, b, t) |
Linear interpolation, clamped |
Color packing, blending, and generation.
ColorUtil.argb(255, 255, 68, 68) // pack to ARGB int
ColorUtil.withAlpha(0xFF4444, 0.8f) // set alpha on existing RGB
ColorUtil.lerp(0xFF4444, 0x44FF44, 0.5f) // blend two colors
ColorUtil.healthColor(0.3f) // red → yellow → green gradient
ColorUtil.fromHSV(0.0f, 1f, 1f) // pure red
ColorUtil.rainbow(now, 1.0f, 1f, 1f) // animated rainbowNumeric utilities missing from Java's standard library.
MathUtil.clamp(value, 0, 100)
MathUtil.remap(value, 0, 100, 0f, 1f)
MathUtil.approach(current, target, step) // move toward target by at most step
MathUtil.smoothLerp(current, target, dt, speed)
MathUtil.wrap(angle, 0, 360)Helpers for building Minecraft Text components.
TextUtil.colored("Hello", 0xFF4444) // hex-colored text
TextUtil.toggleLabel("Combat HUD", true) // "Combat HUD: §aON"
TextUtil.onOff(enabled) // "§aON" or "§cOFF"
TextUtil.join(Text.literal(" | "), a, b, c) // join with separatorClient-side deferred and repeating task scheduler. Ticked automatically each client tick by AStudioLibClient.
TickScheduler.schedule(20, () -> doSomething()); // once, after 1 second
TickScheduler.scheduleRepeating(0, 20, () -> pulse()); // every second, starting now
TickScheduler.cancelAll();Inventory query helpers. Searches the full inventory including offhand.
InventoryUtil.count(player, Items.TOTEM_OF_UNDYING) // total count
InventoryUtil.has(player, Items.TOTEM_OF_UNDYING) // at least one?
InventoryUtil.has(player, item, 3) // at least 3?
InventoryUtil.findSlot(player, item) // slot index or -1
InventoryUtil.isHolding(player, item) // main or offhand?Static DrawContext helpers for the AttackStudio dark-theme UI (0x1a1a2e panel background).
// Color helpers
HudRenderer.color(0xFF4444, 200); // int alpha
HudRenderer.color(0xFF4444, 0.8f); // float alpha
// Panel chrome
HudRenderer.drawPanel(ctx, x, y, w, h, alpha);
HudRenderer.drawTopGlow(ctx, x, y, w, accentColor, alpha);
HudRenderer.drawBorders(ctx, x, y, w, h, accentColor, alpha, now);
HudRenderer.drawDivider(ctx, x, y, w, accentColor, alpha);
HudRenderer.drawCornerBrackets(ctx, x, y, w, h, accentColor, alpha, now);
HudRenderer.drawShimmer(ctx, x, y, w, h, alpha, now, 0.12f);
// Progress bar
HudRenderer.drawBar(ctx, x, y, w, h, percent, barColor, alpha);
// Tooltips
HudRenderer.drawTooltipBox(ctx, x, y, w, h, accentColor, bgAlpha);
HudRenderer.drawTextWithBackground(ctx, tr, text, x, y, textColor, bgColor, bgAlpha, padding);
// Scrollable region fades
HudRenderer.drawFadeTop(ctx, x, y, w, fadeHeight, alpha);
HudRenderer.drawFadeBottom(ctx, x, y, w, fadeHeight, alpha);
// Scrollbar
HudRenderer.drawScrollbar(ctx, x, y, h, scrollY, contentH, accentColor, alpha);Self-contained 2D particle simulation for GUI screens.
ParticleSystem particles = new ParticleSystem(12);
// In Screen.init()
if (!particles.isInitialized()) particles.init(panelX, panelY, panelW, panelH);
// In Screen.render()
particles.update();
particles.render(context, 0x4a90d9, panelAlpha);One-liner Minecraft system toast notifications (top-right corner).
Toast.show("Title", "Something happened.");
Toast.show(Text.literal("§bTitle"), Text.literal("Colored message."));
Toast.show("Title only");One-liner sound playback helpers.
SoundUtil.play(player, SoundEvents.ENTITY_ARROW_HIT_PLAYER, 1.0f, 1.2f);
SoundUtil.play(player, SoundEvents.UI_BUTTON_CLICK);
SoundUtil.playPitched(player, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1.5f);
SoundUtil.playRandom(player, SoundEvents.BLOCK_NOTE_BLOCK_HARP, 1.0f, 0.8f, 1.2f);Thin wrapper around Fabric's KeyBindingHelper for easy keybinding registration and polling.
// In your ClientModInitializer
KeyBinding openMenu = KeybindHelper.register(
"key.mymod.open_menu",
GLFW.GLFW_KEY_K,
"key.category.mymod"
);
// In a tick listener (or use KeybindHelper.tickAll() via AStudioLibClient)
if (openMenu.wasPressed()) client.setScreen(new MyScreen());
if (KeybindHelper.isHeld(openMenu)) { /* held logic */ }A shared /studiolib command registry. Mods register subcommands during onInitializeClient().
StudioCommand.register("mymod", "status", "Show mod status", ctx -> {
ctx.getSource().sendFeedback(Text.literal("Everything is fine."));
return 1;
});In-game:
/studiolib → lists all registered modules
/studiolib mymod → lists mymod's commands
/studiolib mymod status → runs the command
1. Clone and publish to Maven local:
git clone https://github.com/AttackStudios/AStudioLib.git
cd AStudioLib
./gradlew publishToMavenLocal2. Add to your build.gradle:
repositories {
mavenLocal()
}
dependencies {
modImplementation "net.attackstudioyt:astudiolib:1.1.0"
}3. Declare the dependency in fabric.mod.json:
"depends": {
"astudiolib": "*"
}./gradlew build # Compile and package
./gradlew publishToMavenLocal # Publish to local Maven cache
./gradlew clean # Clean build artifactsOutput JAR: build/libs/astudiolib-<version>.jar
| Version | |
|---|---|
| Minecraft | 1.21.11 |
| Fabric Loader | ≥ 0.18.4 |
| Fabric API | 0.141.3+1.21.11 |
| Java | 21 |
CC0-1.0 — public domain. Use it however you like.