Enum Class CottonHud

java.lang.Object
java.lang.Enum<CottonHud>
io.github.cottonmc.cotton.gui.client.CottonHud
All Implemented Interfaces:
Serializable, Comparable<CottonHud>, Constable, net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback

@Environment(CLIENT) public enum CottonHud extends Enum<CottonHud> implements net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
Manages widgets that are painted on the in-game HUD.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Positioners can be used to change the position of a widget based on the window dimensions.

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
     
  • Field Summary

    Fields inherited from interface net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback

    EVENT
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add​(WWidget widget)
    Adds a new widget to the HUD.
    void
    add​(WWidget widget, int x, int y)
    Adds a new widget to the HUD at the specified offsets.
    void
    add​(WWidget widget, int x, int y, int width, int height)
    Adds a new widget to the HUD at the specified offsets and resizes it.
    void
    add​(WWidget widget, CottonHud.Positioner positioner)
    Adds a new widget to the HUD with a custom positioner.
    void
    add​(WWidget widget, CottonHud.Positioner positioner, int width, int height)
    Adds a new widget to the HUD with a custom positioner and resizes it.
    void
    onHudRender​(net.minecraft.client.util.math.MatrixStack matrices, float tickDelta)
     
    void
    remove​(WWidget widget)
    Removes the widget from the HUD.
    void
    setPositioner​(WWidget widget, CottonHud.Positioner positioner)
    Sets the positioner of the widget.
    static CottonHud
    valueOf​(String name)
    Returns the enum constant of this class with the specified name.
    static CottonHud[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • INSTANCE

      public static final CottonHud INSTANCE
  • Method Details

    • values

      public static CottonHud[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CottonHud valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • add

      public void add(WWidget widget)
      Adds a new widget to the HUD.
      Parameters:
      widget - the widget
    • add

      public void add(WWidget widget, int x, int y)
      Adds a new widget to the HUD at the specified offsets.
      Parameters:
      widget - the widget
      x - the x offset
      y - the y offset
      See Also:
      documentation about the offsets
    • add

      public void add(WWidget widget, int x, int y, int width, int height)
      Adds a new widget to the HUD at the specified offsets and resizes it.
      Parameters:
      widget - the widget
      x - the x offset
      y - the y offset
      width - the width of the widget
      height - the height of the widget
      See Also:
      documentation about the offsets
    • add

      public void add(WWidget widget, CottonHud.Positioner positioner)
      Adds a new widget to the HUD with a custom positioner.
      Parameters:
      widget - the widget
      positioner - the positioner
    • add

      public void add(WWidget widget, CottonHud.Positioner positioner, int width, int height)
      Adds a new widget to the HUD with a custom positioner and resizes it.
      Parameters:
      widget - the widget
      positioner - the positioner
      width - the width of the widget
      height - the height of the widget
    • setPositioner

      public void setPositioner(WWidget widget, CottonHud.Positioner positioner)
      Sets the positioner of the widget.
      Parameters:
      widget - the widget
      positioner - the positioner
    • remove

      public void remove(WWidget widget)
      Removes the widget from the HUD.
      Parameters:
      widget - the widget
    • onHudRender

      public void onHudRender(net.minecraft.client.util.math.MatrixStack matrices, float tickDelta)
      Specified by:
      onHudRender in interface net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback