/Toasts

A Fabric library which makes creating and displaying 'toasts' in Minecraft easier

Primary LanguageJavaMIT LicenseMIT

image

Toasts

Toasts is a Fabric library which makes creating and displaying 'toasts' in Minecraft easier.

The main branch is the latest stable version of Toasts, for current development, see the dev branch.

Adding to your mod

TODO

Usage

Creating and showing a toast

new BasicToastBuilder()
        .title("My toast")
        .description("Hello World") // Only required option
        .build()
        .show();

Adding an icon to a toast

new BasicToastBuilder()
        .title("My toast")
        .description("Hello World") // Only required option
        .icon(new Identifier("textures/item/diamond_sword.png"))
        .build()
        .show();

Dismissing the toast after a certain amount of time

// This toast will dismiss after 2000 ms
new BasicToastBuilder()
        .title("My toast")
        .description("Hello World") // Only required option
        .displayTime(2000)
        .build()
        .show();

Executing code when the toast dismisses

new BasicToastBuilder()
        .title("My toast")
        .description("Hello World") // Only required option
        .decayHandler(()->System.out.println("Toast completed!"))
        .build()
        .show();