Interface HeartBarContext

All Known Implementing Classes:
HeartBarContextImpl

@NonExtendable public interface HeartBarContext
Stores data associated with the heart bar as it was last drawn.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The current amount of health displayed on the health bar, in units of half-hearts.
    int
    The maximum allowed size of the heart bar, in units of half-hearts.
    @UnmodifiableView SequencedCollection<org.joml.Vector2i>
    An unmodifiable sequenced collection containing positions of individual hearts as rendered on the screen in the heart bar.
  • Method Details

    • positions

      @UnmodifiableView SequencedCollection<org.joml.Vector2i> positions()
      An unmodifiable sequenced collection containing positions of individual hearts as rendered on the screen in the heart bar.

      This list is ordered such that earlier hearts represent smaller health values. For vanilla player health, this means it is ordered left-to-right, bottom-to-top. For vanilla mount health, it is right-to-left, bottom-to-top.

      For non-vanilla heart bars, this could be in some other order.

    • currentDisplayHalfHearts

      int currentDisplayHalfHearts()
      The current amount of health displayed on the health bar, in units of half-hearts.

      May exceed the maxDisplayHalfHearts() when used with mods that layer multiple heart bars on top of each other, such as Colorful Hearts.

    • maxDisplayHalfHearts

      int maxDisplayHalfHearts()
      The maximum allowed size of the heart bar, in units of half-hearts.