Class GuiProgressIcon

All Implemented Interfaces:
BackgroundRender, ElementEvents, GuiParent<GuiProgressIcon>, TooltipHandler<GuiProgressIcon>

public class GuiProgressIcon extends GuiElement<GuiProgressIcon> implements BackgroundRender
This can be used to create a simple progress indicator like those used in machines like furnaces.

The background texture (if one is used) and the animated texture must be the same shape and size, They must be designed so that the animated texture can be rendered directly on top of the background texture with no offset. The animated texture should not have any empty space on ether end as the entire width of the texture is used in the animation.

Texture must be designed for left to right animation,

Created by brandon3055 on 04/09/2023

  • Constructor Details

  • Method Details

    • setRotateToDirection

      public GuiProgressIcon setRotateToDirection(boolean rotateToDirection)
      The expected default direction for a progress texture is left-to-right e.g. furnace arrow. The texture will then be rotated to the direction specified via setDirection(Direction) If you do not want the texture to be rotated then set this to false.
    • setDirection

      public GuiProgressIcon setDirection(Direction direction)
      Set the direction this progress icon is pointing, Default is RIGHT
    • setBackground

      public GuiProgressIcon setBackground(@Nullable @Nullable Material background)
      Sets the background texture, aka the "empty" texture.
    • setBackground

      public GuiProgressIcon setBackground(@Nullable @Nullable Supplier<Material> background)
      Sets the background texture, aka the "empty" texture.
    • setAnimated

      public GuiProgressIcon setAnimated(Material animated)
      Sets the texture that will be animated.
    • setAnimated

      public GuiProgressIcon setAnimated(Supplier<Material> animated)
      Sets the texture that will be animated.
    • setProgress

      public GuiProgressIcon setProgress(double progress)
      Set the current progress to a fixed value.
      See Also:
    • setProgress

      public GuiProgressIcon setProgress(Supplier<Double> progress)
      Attach a supplier that returns the current progress value for this progress icon (0 to 1)
    • getProgress

      public double getProgress()
    • renderBackground

      public void renderBackground(GuiRender render, double mouseX, double mouseY, float partialTicks)
      Description copied from interface: BackgroundRender
      Used to render content behind this elements child elements. When rendering element content, always use the PoseStack available via the provided GuiRender Where applicable, always use push/pop to ensure the stack is returned to its original state after your rendering is complete.
      Specified by:
      renderBackground in interface BackgroundRender
      Parameters:
      render - Contains gui context information as well as essential render methods/utils including the PoseStack.