Class AdvancementDisplay
java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.AdvancementDisplay
Defines the visual representation of an advancement in the client menu.
This class encapsulates all metadata required by the client to render the
advancement's icon, title, description, and its relative position within the
advancement tab.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA fluent builder class for creatingAdvancementDisplayinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<AdvancementDisplay> The codec responsible for serializing and deserializing advancement display data. -
Constructor Summary
ConstructorsConstructorDescriptionAdvancementDisplay(net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component description, org.bukkit.inventory.ItemStack icon, net.kyori.adventure.key.Key background, AdvancementFrame frame, boolean showToast, boolean announceToChat, boolean hidden, float x, float y) Constructs a new AdvancementDisplay with full visual and positional data. -
Method Summary
Modifier and TypeMethodDescriptionstatic AdvancementDisplay.Builderbuilder()Creates a new builder instance for constructing AdvancementDisplay objects.net.kyori.adventure.key.KeyRetrieves the resource key for the background texture, used primarily for root nodes.net.kyori.adventure.text.ComponentRetrieves the description component providing details about the advancement task.getFrame()Retrieves the border frame style used to categorize the advancement difficulty or type.org.bukkit.inventory.ItemStackgetIcon()Retrieves the item stack assigned as the icon for this advancement.net.kyori.adventure.text.ComponentgetTitle()Retrieves the display title of the advancement.floatgetX()Retrieves the horizontal position of the advancement node within the GUI.floatgetY()Retrieves the vertical position of the advancement node within the GUI.booleanChecks if the completion of this advancement should be announced to the global chat.booleanisHidden()Checks if the advancement is hidden from the advancement tree until it is achieved.booleanChecks if the completion of this advancement triggers a toast notification.voidsetPosition(float x, float y) Sets the visual coordinates for this advancement within the client tree GUI.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing advancement display data. This allows the display information to be easily saved to or loaded from various data formats like JSON or NBT.
-
-
Constructor Details
-
AdvancementDisplay
public AdvancementDisplay(net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component description, org.bukkit.inventory.ItemStack icon, net.kyori.adventure.key.Key background, AdvancementFrame frame, boolean showToast, boolean announceToChat, boolean hidden, float x, float y) Constructs a new AdvancementDisplay with full visual and positional data.- Parameters:
title- The AdventureComponentfor the title.description- The AdventureComponentfor the description.icon- TheItemStackicon.background- The resourceKeyfor the background (nullable).frame- TheAdvancementFrameborder style.showToast- Whether to show a popup toast.announceToChat- Whether to broadcast completion to chat.hidden- Whether the advancement is hidden until earned.x- The horizontal position in the GUI tree.y- The vertical position in the GUI tree.
-
-
Method Details
-
getTitle
public net.kyori.adventure.text.Component getTitle()Retrieves the display title of the advancement.- Returns:
- The title
Component.
-
getDescription
public net.kyori.adventure.text.Component getDescription()Retrieves the description component providing details about the advancement task.- Returns:
- The description
Component.
-
getIcon
public org.bukkit.inventory.ItemStack getIcon()Retrieves the item stack assigned as the icon for this advancement.- Returns:
- The
ItemStackicon.
-
getBackground
public net.kyori.adventure.key.Key getBackground()Retrieves the resource key for the background texture, used primarily for root nodes.- Returns:
- The background texture
Key, or null if not applicable.
-
getFrame
Retrieves the border frame style used to categorize the advancement difficulty or type.- Returns:
- The
AdvancementFramestyle.
-
isShowToast
public boolean isShowToast()Checks if the completion of this advancement triggers a toast notification.- Returns:
- True if a toast should be displayed.
-
isAnnounceToChat
public boolean isAnnounceToChat()Checks if the completion of this advancement should be announced to the global chat.- Returns:
- True if the advancement should be announced.
-
isHidden
public boolean isHidden()Checks if the advancement is hidden from the advancement tree until it is achieved.- Returns:
- True if the advancement is currently hidden.
-
getX
public float getX()Retrieves the horizontal position of the advancement node within the GUI.- Returns:
- The X coordinate as a float.
-
getY
public float getY()Retrieves the vertical position of the advancement node within the GUI.- Returns:
- The Y coordinate as a float.
-
setPosition
public void setPosition(float x, float y) Sets the visual coordinates for this advancement within the client tree GUI.- Parameters:
x- The new horizontal position.y- The new vertical position.
-
builder
Creates a new builder instance for constructing AdvancementDisplay objects.- Returns:
- A new
AdvancementDisplay.Builderinstance.
-