apace100 / apoli

MIT License
40 stars 46 forks source link

Add `show_toast` entity action type #192

Closed eggohito closed 6 months ago

eggohito commented 11 months ago

This PR adds a show_toast entity action type, and new classes: CustomToast for displaying a toast with configurable text and duration, CustomToastData, used for serializing data to be used for displaying CustomToasts, and CustomToastViewer (duck interface), mostly for implementing S2C packet transaction for displaying a toast from the server to the client

The show_toast entity action type accepts these fields:

Field Type Default Description
title Text Component The text to be used as the title of the toast.
description Text Component The text to be used as the description of the toast.
texture Identifier "apoli:toast/custom" If specified, the texture with this ID will be used as the texture of the toast. If the texture does not exist, the default texture will be used instead.
icon Item Stack optional The item stack to be used as the icon of the toast.
duration Integer 5000 Determines how long the toast will stay on the screen in ticks.