Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add show_toast entity action type #192

Merged
merged 7 commits into from
May 30, 2024

Conversation

eggohito
Copy link
Collaborator

@eggohito eggohito commented Dec 14, 2023

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.

@eggohito eggohito linked an issue Dec 14, 2023 that may be closed by this pull request
@eggohito eggohito added this to the 2.12.x milestone Dec 22, 2023
+ Added a custom toast, with configurable title, description, icon, duration and sound
+ Added `show_toast` entity action type for displaying a custom toast
From "DynamicToast..." to "CustomToast..."
+ Added `texture` field; used for specifying a custom texture for the custom toast
- Removed `sound_event` field, as it isn't really necessary
* The size of the toast now depends on the length of the description
@eggohito eggohito force-pushed the feat/entity_action_types/show_toast branch from fc2fdbf to fbf3b03 Compare February 23, 2024 17:18
@eggohito eggohito changed the base branch from 1.20 to 1.20.4/dev May 17, 2024 04:40
eggohito added 2 commits May 19, 2024 20:42
+ Added helper methods for creating custom toast data from a serializable data instance, and converting a custom toast data to a serializable data instance
* Fixed issue with adjusting the height of the rendered toast
* Made `show_toast` entity action type accept the fields of a custom toast data directly, instead of nesting it in a `toast` field
@eggohito eggohito added the pending: merge This will be merged soon label May 19, 2024
eggohito added 2 commits May 30, 2024 16:15
…ow_toast

# Conflicts:
#	src/main/java/io/github/apace100/apoli/mixin/ServerPlayerEntityMixin.java
@eggohito eggohito merged commit ca11363 into 1.20.4/dev May 30, 2024
@eggohito eggohito deleted the feat/entity_action_types/show_toast branch May 30, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending: merge This will be merged soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Suggestion] A new Entity Action apoli:show_toast
1 participant