Class AdvancementDisplay

java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.AdvancementDisplay

public class AdvancementDisplay extends Object
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 Classes
    Modifier and Type
    Class
    Description
    static class 
    A fluent builder class for creating AdvancementDisplay instances.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The codec responsible for serializing and deserializing advancement display data.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new builder instance for constructing AdvancementDisplay objects.
    net.kyori.adventure.key.Key
    Retrieves the resource key for the background texture, used primarily for root nodes.
    net.kyori.adventure.text.Component
    Retrieves the description component providing details about the advancement task.
    Retrieves the border frame style used to categorize the advancement difficulty or type.
    org.bukkit.inventory.ItemStack
    Retrieves the item stack assigned as the icon for this advancement.
    net.kyori.adventure.text.Component
    Retrieves the display title of the advancement.
    float
    Retrieves the horizontal position of the advancement node within the GUI.
    float
    Retrieves the vertical position of the advancement node within the GUI.
    boolean
    Checks if the completion of this advancement should be announced to the global chat.
    boolean
    Checks if the advancement is hidden from the advancement tree until it is achieved.
    boolean
    Checks if the completion of this advancement triggers a toast notification.
    void
    setPosition(float x, float y)
    Sets the visual coordinates for this advancement within the client tree GUI.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CODEC

      public static final Codec<AdvancementDisplay> 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 Adventure Component for the title.
      description - The Adventure Component for the description.
      icon - The ItemStack icon.
      background - The resource Key for the background (nullable).
      frame - The AdvancementFrame border 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 ItemStack icon.
    • 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

      public AdvancementFrame getFrame()
      Retrieves the border frame style used to categorize the advancement difficulty or type.
      Returns:
      The AdvancementFrame style.
    • 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

      public static AdvancementDisplay.Builder builder()
      Creates a new builder instance for constructing AdvancementDisplay objects.
      Returns:
      A new AdvancementDisplay.Builder instance.