Loading
Docs / Components / Toasts
v1.0.0 JAVA MOD LIBRARY

Toasts

Floating

ui.toast(...) renders a 20px tall dark notification pill (#1E1E1E inside a #1E1E1F 1px frame with a +4px 50% black drop shadow) using OreFont.NOTO_SANS for clean legibility. By default it slides upward 32px while fading in over 0.12s; passing a key containing "static" skips the entrance animation. Returns the rendered width.

Write your text here...
World saved successfully (Noto Sans)
Achievement Unlocked!

Method Signatures (OreUi)

// Measure width of the toast pill (including Noto Sans text + optional icons)
public int toastWidth(String label, boolean leading, boolean trailing)

// Draw toast pill (returns rendered width)
public int toast(int x, int y, String label, String key, boolean leading, boolean trailing)

Parameters

ParameterTypeDescription
x, yintTop-left GUI pixel coordinates (height is 20px).
labelStringNotification text rendered in OreFont.NOTO_SANS.
keyStringUnique slide-in animation key ("toast:" + key). Include "static" to disable entrance motion.
leadingbooleanDraws leading info glyph before text.
trailingbooleanDraws trailing close glyph after text.

Example

String notice = "Achievement unlocked: Getting Wood";
int w = ui.toastWidth(notice, true, false);
int x = (this.width - w) / 2;
int y = this.height - 40;

ui.toast(x, y, notice, "toastWood", true, false);