Class AbstractBarLayer

java.lang.Object
com.github.darksoulq.abyssallib.world.gui.layer.AbstractBarLayer
All Implemented Interfaces:
GuiLayer
Direct Known Subclasses:
ProgressBarLayer

public abstract class AbstractBarLayer extends Object implements GuiLayer
An abstract foundation for multi-slot progress bars using Custom Model Data.

This layer manages a "structure" of items across multiple slots. It calculates how many slots should be "filled" based on a 0-100 percentage and updates individual item states using a custom model data string property: bar_progress=[state].

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes the bar from the GUI and clears cache.
    void
    Recalculates and renders the bar's state to the GUI.
    void
    setName(net.kyori.adventure.text.Component name)
    Sets a custom display name for all item segments in the bar.
    void
    setProgress(float progress)
    Sets the fill percentage of the bar.

    Methods inherited from class Object

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

    • setProgress

      public void setProgress(float progress)
      Sets the fill percentage of the bar.
      Parameters:
      progress - A float between 0 and 100.
    • setName

      public void setName(net.kyori.adventure.text.Component name)
      Sets a custom display name for all item segments in the bar.
      Parameters:
      name - The text component to display on hover.
    • renderTo

      public void renderTo(GuiView view)
      Recalculates and renders the bar's state to the GUI.

      Only updates slots whose specific progress state or name has changed.

      Specified by:
      renderTo in interface GuiLayer
      Parameters:
      view - The active GUI view.
    • cleanup

      public void cleanup(GuiView view)
      Removes the bar from the GUI and clears cache.
      Specified by:
      cleanup in interface GuiLayer
      Parameters:
      view - The active view.