Class TexturedBossBar

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.bossbar.TexturedBossBar
All Implemented Interfaces:
BossBarRenderer

public final class TexturedBossBar extends Object implements BossBarRenderer
A boss bar drawn from one texture: a frame (with whatever dresses it: an emblem, thorns, a blade), and inside its track a fill for the health and a trail for what was just lost. Optional: marks that light once the bar falls past them (phases), a glow that pulses over a point (an eye, a gem; faster as the bar empties), a jolt and a flash on each hit, and the name in a colour of its own above it.
TexturedBossBar.builder(MyMod.id("textures/gui/boss/warden.png"), 240, 48)
        .frame(0, 0, 240, 30)           // the frame's place in the texture, and its size
        .track(35, 12, 180, 7)          // the inside of its track, within the frame
        .fill(0, 32).trail(0, 40)       // where the fill and the trail are in the texture (track-sized)
        .mark(0.5F, 200, 32, 2, 13, -3) // at half, a lit mark (2 x 13 from 200, 32), 3 px above the track
        .pulse(184, 32, 12, 12, 7)      // a 12 x 12 glow, centred on (7, 14) of the frame
        .at(7, 14)
        .nameColor(0xFFE8A0A8)
        .build();
  • Method Details

    • builder

      public static TexturedBossBar.Builder builder(net.minecraft.resources.Identifier texture, int textureWidth, int textureHeight)
      A bar from a texture of this size.
    • render

      public int render(net.minecraft.client.gui.GuiGraphicsExtractor graphics, BossBarView bar, int y)
      Description copied from interface: BossBarRenderer
      Draws the bar with its top edge at y, centred across the screen (as the game's are).
      Specified by:
      render in interface BossBarRenderer
      Returns:
      how much height it took, so the next bar goes below it