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(SpriteSupplier background)
      Sets the background texture, aka the "empty" texture.
    • setAnimated

      public GuiProgressIcon setAnimated(SpriteSupplier 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()
    • renderBehind

      public void renderBehind(net.minecraft.client.gui.GuiGraphics graphics, 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
      invalid reference
      GuiRender
      Where applicable, always use push/pop to ensure the stack is returned to its original state after your rendering is complete.
      Specified by:
      renderBehind in interface BackgroundRender
      Parameters:
      graphics - Contains gui context information as well as essential render methods/utils including the PoseStack.